pymongo: filtering nested field with find()

229 views
Skip to first unread message

Nicolas Clairon

unread,
Jun 2, 2009, 8:58:21 AM6/2/09
to mongod...@googlegroups.com
Hi !

There is a little issue in pymongo. In mongo shell, we can filter nested field :

> db.example.save({"bla":"ble", "foo":{"bar":1}})
> db.example.find({}, {"foo":{"bar":1}})
{"_id" : "4a24f22c09b1396a31ddae14" , "foo" : {"bar" : 1}}

but with pymongo, it doen't work:

>>> list(db.example.find({}, ["foo.bar"]))
[]

Any ideas ?

Nicolas

Michael Dirolf

unread,
Jun 2, 2009, 9:07:30 AM6/2/09
to mongod...@googlegroups.com
this is an oversight with the code that translates from lists of keys
to selectors - i've filed a bug here:
http://jira.mongodb.org/browse/PYTHON-23

Michael Dirolf

unread,
Jun 2, 2009, 1:03:58 PM6/2/09
to mongod...@googlegroups.com
in the most recent version on github the driver will translate these
queries properly. there still might be issues in the server however, i
noticed a possible bug during testing on this issue:

http://jira.mongodb.org/browse/SERVER-89

just a heads up if you run into problems.

On Jun 2, 2009, at 8:58 AM, Nicolas Clairon wrote:

>

Nicolas Clairon

unread,
Jun 2, 2009, 1:48:50 PM6/2/09
to mongod...@googlegroups.com
ok thanks
Reply all
Reply to author
Forward
0 new messages