MongoDB Inline query request objects

Does anyone have an example query for nested / internal objects in MongoDB using NORM (C #)? For example, if a typical document in the collection looks like Order / OrderItems, how can I find a specific OrderItem by OrderItem.Quantity> 10.

+4
source share
2 answers

Having typed this from memory, I'm sorry if this is not so:

using ( var session = new MongoSession<Order>( DbName ) ) { var orders = session.Queryable .Where( o => o.OrderItems.Any( oi => oi.Quantity > 10 ) ) .ToList(); } 
0
source

You need to create an additional β€œsize” of the field, which you increase when adding new elements and request it.

0
source

Source: https://habr.com/ru/post/1310793/


All Articles