Here is the setup.
user has_many skills
skills belongs_to user
I would have to find out all users that have skills with ids 1,2 and 3
I can use intersection of three user collections.
Skill.find(1).users & Skill.find(2).users & Skill.find(3).users
But this does not seem efficient. Is there a query in Mongoid/MongoDB that resembles the following?
User.where(:skill_ids.contains=>[1,2,3])
PS: I know Mongoid gives the in keyword:
User.where(:skill_id.in=>[1,2,3])