I need query a list with all embedded documents in mongoengine. Here is my schema:
class Variant(EmbeddedDocument):
name = StringField(required=True)
value = StringField(required=True)
class Sku(Document):
variants = ListField(EmbeddedDocumentField(Variant))
I can do it using mongo shell with:
db.sku.find({variants: [{'name': 'xxx', 'value': 'xxx'}]}).pretty()
But I haven't figure out a way to do it in mongoengine. I need the list in the document is exactly the same with the list I put in the query. Any ideas?