开发者

Mongoid syntax for querying based on several sets of attributes

开发者 https://www.devze.com 2023-02-13 19:12 出处:网络
Assuming I want to g开发者_Go百科et 3 documents which fit one of these attributes Class Question:

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

精彩评论

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

关注公众号