F() objects in mongoengine similar to that in django

人走茶凉 提交于 2019-12-11 11:44:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!