Include not returning all documents specified

19 views
Skip to first unread message

Nick

unread,
Oct 23, 2016, 2:29:20 AM10/23/16
to RavenDB - 2nd generation document database
When I combine includes as below where the document are specified as a mix of expressions and straight Ids the documents not specified with Ids are not returned, in this example the AddressBook document is not returned

return session.Marketplace
    .Include<Entities.Basket>(b => b.Items.Select(i => i.ProductId))
    .Include<Entities.Basket>(b => b.Items.Select(i => i.ImageId))
    .Include(AddressBook.GetId(User.GetId(userId)))
    .Load<Entities.Basket>(Entities.Basket.GetId(User.GetId(userId)));

Attached is a fiddler session showing the initial request with the includes then a subsequent request to get the address book as its not in the session after the initial load.

This is obviously resulting in lots of unnecessary database traffic, so is it a known issue, limitation or a bug?

Thanks

Nick
Includes-Session.saz

Nick

unread,
Oct 23, 2016, 2:29:52 AM10/23/16
to RavenDB - 2nd generation document database
Sorry - 3.5 RC3 build

Maxim Buryak

unread,
Oct 23, 2016, 4:30:54 AM10/23/16
to rav...@googlegroups.com

Hi,
I'm not sure what the .GetId(...) function does, I could guess it strips the numeric suffix of id string and generates a new Id, based on entity type, please send it's definition(s) to be sure.

Meanwhile, I could tell you that the Include function does what you've described - receive paths inside the documents, gets document IDs from those paths and brings documents according to IDs The include does not receive plain IDs as parameters. 

I could see where you confusion come from - you thought that the overload that receives strings is meant for IDs, but the function description says that it receives a path meaning path inside the document. I recommend you to explore our lazy API, see: http://ravendb.net/docs/article-page/3.5/csharp/client-api/session/how-to/perform-operations-lazily, that will allow you to bring both of the request in one request.

For further reading about the load operation see: http://ravendb.net/docs/article-page/3.5/csharp/client-api/session/loading-entities



--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nick Champion

unread,
Oct 23, 2016, 5:15:46 AM10/23/16
to rav...@googlegroups.com
Hi Maxim,

My mistake! thanks for the explanation, i'll refactor to use the Lazy API

Thanks

--
You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/i6LRGWlv-rU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages