From c9dc4419152fe4e25bee5e8fcfc063f9560d8615 Mon Sep 17 00:00:00 2001 From: veera Date: Mon, 5 Aug 2013 15:33:54 +0530 Subject: [PATCH] Overridden the prepare_query_value method in SequenceField inorder to return the value as the required type. --- mongoengine/fields.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mongoengine/fields.py b/mongoengine/fields.py index 826e1258..f8830d08 100644 --- a/mongoengine/fields.py +++ b/mongoengine/fields.py @@ -1517,6 +1517,14 @@ class SequenceField(BaseField): return super(SequenceField, self).__set__(instance, value) + def prepare_query_value(self, op, value): + """ + This method is overriden in order to convert the query value into to required + type. We need to do this in order to be able to successfully compare query + values passed as string, the base implementation returns the value as is. + """ + return self.value_decorator(value) + def to_python(self, value): if value is None: value = self.generate()