see on GitHub

Commands : Querying : How to query a database?

Use Query method to fetch results of a selected index according to a specified query.


QueryResult Query(
	string index,
	IndexQuery query,
	string[] includes = null, 
	bool metadataOnly = false,
	bool indexEntriesOnly = false);

index string A name of an index to query
query IndexQuery A query definition containing all information required to query a specified index.
includes string[] An array of relative paths that specify related documents ids which should be included in a query result.
metadataOnly bool True if returned documents should include only metadata without a document body.
indexEntriesOnly bool True if query results should contain only index entries.
Return Value
QueryResult Object which represents results of a specified query.

Example I

A sample Query method call that returns orders for a company specified:

result = store.DatabaseCommands.Query("Orders/Totals", new IndexQuery
	Query = "Company:companies/1"

List<RavenJObject> users = result.Results; // documents resulting from this query - orders

Example II

If a model of your documents is such that they reference others and you want to retrieve them together in a single query request, then you need to specify paths to properties that contain IDs of referenced documents:

result = store.DatabaseCommands.Query("Orders/Totals", new IndexQuery(),

List<RavenJObject> referencedDocs = result.Includes; // included documents - companies and employees