开发者

Mongoid syntax for querying based on several sets of attributes

Assuming I want to g开发者_Go百科et 3 documents which fit one of these attributes

Class Question:

name=>a, topic=>b
name=>c, topic=>d
name=>e, topic=>f

What is the appropriate syntax for mongoid to get these?


According to mongoid query syntax:

Model.any_of({:name => a, :topic => b}, 
             {:name => c, :topic => d}, 
             {:name => e, :topic => f})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜