简体   繁体   中英

F() objects in mongoengine similar to that in django

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM