有没有办法在shell中查看mongodb中集合的索引列表?我通读了http://www.mongodb.org/display/DOCS/Indexes,但我什么也没看到
发布于 2010-05-08 06:52:22
在shell中:
db.test.getIndexes()
对于shell帮助,您应该尝试:
help;
db.help();
db.test.help();
发布于 2015-08-26 23:26:39
如果要跨集合列出所有索引,请执行以下操作:
db.getCollectionNames().forEach(function(collection) {
indexes = db.getCollection(collection).getIndexes();
print("Indexes for " + collection + ":");
printjson(indexes);
});
发布于 2013-03-21 05:59:19
如果您想要获取数据库中所有索引的列表:
use "yourdbname"
db.system.indexes.find()
https://stackoverflow.com/questions/2789865
复制相似问题