hmarr/mongoengine — Issue #353: Query operators "in" bindata 
Author: abc125318
Created: 2011-11-10 05:26:42+00:00
State: open

class User(Document):
uuid = BinaryField(required=True,max_bytes=10,unique=True,primary_key=True,default=lambda:rand_uuid(10))

class Follow(Document):
id = BinaryField(required=True,max_bytes=10,unique=True,primary_key=True,default=lambda:rand_uuid(10))
follows = ListField(BinaryField())

if __name__ == "__main__":
connect("test")
user = User.objects().first()
print Q(follows__in=[user.uuid]).to_query(Follow)
#error return {'follows': {'$in': ['kCwzpT8B']}}
#correct query {'follows': {'$in': [BinData(0,'kCwzpT8B')]}}