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}  

Comments

Popular posts from this blog

scala - Play Framework - how to bind form to a session field -

Django Celery - running scheduled tasks -

perl - 'Unquoted string ".." may clash with future reserved word' but only when package is used -