Best way to query a DictField in MongoEngine -
i've been hunting through mongoengine documentation , around stack overflow , there doesn't seem clear answer i'm asking: how best query dictfield? example code:
class note(document): somedata = dictfield() note = note() note.somedata['someid'] = {"name": "steve", "age":25} note.save()
the closest find in docs be:
note.objects(somedata__name="steve")
but hasn't been working again, feel should simple answer. help
you have wrong request, because miss someid
.
see structure in db:
>>> db.note.findone() >>> { "_id": objectid("'0'*24") "somedata": { "someid": { {"name": "steve", "age":25} } } }
so right request note.objects(somedata__someid__name="steve")
.
Comments
Post a Comment