Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通常使用:
@coll.find({"lang"=>@language,"description"=>@description,"location"=>@location},{:limit=>@results_needed}).to_a
但有时我有一个“_ids”数组,我不想包含在结果中。有没有本地方法可以做到这一点?我一直在做黑客,.delete_if但我想让数据库做尽可能多的工作。
.delete_if
关于什么
@coll.find(:id.ne => array_of_ids)
或者
@coll.find(:id => {:$ne => array_of_ids})
从不等于 mongo mapper。