Reputation: 252
I am trying to use RavenDB's REST API to make some calls to my database and I'm wondering if there's a way to use the 'includes' feature to return documents that are nested in a document.
For example, I have an object, Order
, that looks similar to this:
"Order": {
"Lines": [
{
"Product": "products/11-A"
},
{
"Product": "products/42-A"
},
{
"Product": "products/72-A"
}
],
"OrderedAt": "1996-07-04T00:00:00.0000000",
"Company": "companies/85-A"
}
Company
maps to another document and is simple enough to include in the query.
{ "Query": "from Orders include Company" }
My problem is Product
that is nested in Lines
, which is an array of order lines. Since I didn't find anything in the documentation about it I tried things like include Product
or include Lines.Product
, but those didn't work.
Is this kind of thing possible with the REST API? If so, how would I go about doing it?
Upvotes: 3
Views: 349
Reputation: 3839
The syntax to Query for Related Documents from the client can be found in this demo:
https://demo.ravendb.net/demos/csharp/related-documents/query-related-documents
The matching RQL to be used in the Query when using REST API is:
from 'Orders' include 'Lines[].Product'
Upvotes: 3