hmarr/mongoengine — Issue #414: Limit/only does not chain correctly
Author: aclowes
Created: 2012-01-23 20:45:12+00:00
State: open

from mongoengine.document import Document
from mongoengine import fields

class MyCollection(Document):
fieldA = fields.IntField()
fieldB = fields.IntField()
def __unicode__(self): return '%s %s' % (self.fieldA, self.fieldB)

MyCollection.objects.create(fieldA=1, fieldB=1)
MyCollection.objects.create(fieldA=2, fieldB=2)

MyCollection.objects.only('fieldA').limit(1)
Out[21]: []

MyCollection.objects.limit(1).only('fieldA')
Out[22]: []

In the last line I think it should output '1 None' like the prior example.