我在MongoDB控制台中使用了它:
db.video.find( { $or : [ { "tags" : /pePe/i } , { "title" : /.*Aubrey.*/i } ] } )
它工作正常.
如何在Ruby中执行此查询?
使用Mongo驱动程序:
require 'mongo' connect = Mongo::Connection.new database = connect['development'] database['video'].find({ :$or => [{:tags => /pePe/i}, {:title => /.*Aubrey.*/i}] })