f()对象在mongoengine中类似于django [英] F() objects in mongoengine similar to that in django

查看:154
本文介绍了f()对象在mongoengine中类似于django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有类似于mongoengine中的F()对象的东西,类似于Django。



如果是,请帮助我如何使用它。 / p>

如果否,请建议一种在mongoengine中引入类似功能的方法。



任何帮助将非常感谢。
提前感谢

解决方案

您可以使用其中运算符(自v0.5起):

  User.objects().where(this.firstname == this.lastname )

请注意,这是低效的,因为Mongo不会对这些查询使用索引,因此应该避免:



http:/ /docs.mongodb.org/manual/reference/operators/#_S_where


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

这篇关于f()对象在mongoengine中类似于django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆