elasticsales/mongoengine — pull request #6 by hensom (2013-11-13 16:02:17+00:00)
Title: Do not explicitly exclude the '_id' field when returning documents as_py...

The current QuerySet implementation will exclude the _id field from the set of return fields when QuerySet.as_pymongo() is called. Here's an example:

class Sample(Document):
foo = StringField()
zot = StringField()

Sample(foo="bar", zot="baz").save()
raw_doc = list(Sample.objects().only('id', 'foo').as_pymongo())[0]
# raw_doc would be returned as: {'foo': 'bar'}, instead of {''_id': ObjectId('...'), foo': 'bar'}