MongoDB mongoid 里面怎么使用 or?

sanvi · October 31, 2012 · Last by kaka replied at November 07, 2012 · 2787 hits

找到好久都没看到。。。

:field.in => ['one', 'two']

有这么几个常用的:

.any_in(:category => array) .all_in(:category => array) .any_of({ :shape => "round" }, { :color => "red" }) .and(:amount.gt => 100, :account_status => "active")

我的第一反应是{$or:[{:a=>1},{:b=>2}]}

#3 楼 @steven_yue 那么不为空呢?

{:field =>{:$ne => ""}}

#6 楼 @kaka (:name.exists => true)

#7 楼 @sanivbyfish 那是这个字段是否存在

You need to Sign in before reply, if you don't have an account, please Sign up first.