Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ReferenceField query chaining fails #234

Closed
rozza opened this Issue · 2 comments

2 participants

@rozza
Owner

See: http://stackoverflow.com/questions/14901598/mongoengine-chaining-filter-and-referencefield-causes-typeerror-collectio

def test_reference_query_chaining(self):

    class A(Document):
        a = StringField()

    class B(Document):
        b = StringField()
        boolfield = BooleanField(default=False)
        ref = ReferenceField(A)

    A.drop_collection()
    B.drop_collection()

    a = A(a='test').save()
    B(b="hi", boolfield=True, ref=a).save()

    a_objects = A.objects(a='test')
    query = B.objects(ref__in=a_objects)
    query = query.filter(boolfield=True)
    self.assertEquals(query.count(), 1)
@rozza
Owner

Merged fix

@rozza rozza closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.