【发布时间】:2017-10-13 07:56:56
【问题描述】:
谁知道where(:genres.in => [ "rock" ]在mongoid中是什么意思?
我在文档中看到了这些代码:
class Band
include Mongoid::Document
field :country, type: String
field :genres, type: Array
scope :english, ->{ where(country: "England") }
scope :rock, ->{ where(:genres.in => [ "rock" ]) }
end
https://docs.mongodb.com/mongoid/master/tutorials/mongoid-queries/#named-scopes
似乎这意味着找到流派包含“摇滚”但我不确定的文档,因为我找不到解释in的参考。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 mongoid