问题
I'd like to see the existing indexes used by MongoDB. Can I do the equivalent of
$ mongod
> use my_db
> db.system.indexes.find()
using Mongoid?
$ rails console
> ?
Would be convenient from my heroku apps using MongoHQ. Thanks!
回答1:
You can get at the underlying indexes for a Mongoid model through its collection
.
> YourModel.collection.indexes
This reaches down into the moped driver (in Mongoid 3). See http://mongoid.org/en/moped/docs/driver.html
来源:https://stackoverflow.com/questions/12193591/see-existing-indexes-in-mongodb-using-mongoid