使用mongoid查看MongoDB中的现有索引 [英] See existing indexes in MongoDB using mongoid
本文介绍了使用mongoid查看MongoDB中的现有索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想看看MongoDB使用的现有索引。我可以做相当于
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()
使用Mongoid?
$ rails console
> ?
使用MongoHQ可以方便地使用我的heroku应用程序。谢谢!
Would be convenient from my heroku apps using MongoHQ. Thanks!
推荐答案
您可以通过集合获取Mongoid模型的基础索引
。
> YourModel.collection.indexes
这可以达到轻便摩托车司机(在Mongoid 3中)。请参见 http://mongoid.org/en/moped/docs/driver.html
This reaches down into the moped driver (in Mongoid 3). See http://mongoid.org/en/moped/docs/driver.html
这篇关于使用mongoid查看MongoDB中的现有索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文