hmarr/mongoengine — Issue #365: with_id() should maybe use the existing QuerySet
Author: joeshaw
Created: 2011-11-22 16:36:55+00:00
State: open

It took me a bit by surprise when I called `with_id()` passing an ID that would not have matched my existing QuerySet, but it was returned anyway.

Example:

class Foo(Document):
name = StringField()

f1 = Foo(name="f1")
f1.save()

f2 = Foo(name="f2")
f2.save()

Foo.objects(name="f2").with_id(f1.id)
# returns the f1 object; I was expecting None since I had limited it to name="f2"

Even if you decide not to change the behavior, it'd be good to update the docs to say that the existing QuerySet is not taken into account with this function.