开发者

Querying indexes in mongoid

开发者 https://www.devze.com 2023-04-06 03:07 出处:网络
Just wondering, if I index a field in mongoid is there a special query form I should be using to speed up queries using that 开发者_运维百科index or does Class.where(index: value) utilize that automat

Just wondering, if I index a field in mongoid is there a special query form I should be using to speed up queries using that 开发者_运维百科index or does Class.where(index: value) utilize that automatically?


I quote the creator of the Mongoid ODM from the following bug report in GitHub https://github.com/mongoid/mongoid/issues/1276

If you have fields that are indexed then it's determined on the database side if the index is to be used - there's nothing special on the Mongoid side of things when using criteria to provide index hints. Please remember though if you created the index in Mongoid to run rake db:create_indexes to ensure it actually got created in the db.

0

精彩评论

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

关注公众号