mongodb - How to write Mongo DB query that compares embedded documents? -
Consider an order document with several line items embedded documents and single specially embedded documents. With any type of linearity to find the order, it works: find ({'lineItems.type': 'food'}) How to find an order At least one LineItem type is not similar to the type of the speciallifetime? In addition, some orders have no lineites. For example, find this document: lineItems: {type: food}, {type: wood} speciallinks: {type: food} but No: line items: {type: food} specialElement: {type: food} or line items: [ ] SpecialElement: {type: food}