问题
Do we have something similar to F() objects in mongoengine, similar to that in Django.
If yes then please help me in how to use it.
If No then please suggest a way to incorporate similar functionality in mongoengine.
Any help would be really appreciated. Thanks in advance.
回答1:
You can use where
operator ( since v0.5 ):
User.objects( ).where( "this.firstname == this.lastname" )
Note that this is inefficient, since Mongo will not use indexes with these queries and thus it should be avoided:
http://docs.mongodb.org/manual/reference/operators/#_S_where
来源:https://stackoverflow.com/questions/14119005/f-objects-in-mongoengine-similar-to-that-in-django