我正在尝试获取集合的索引。
> db.version()
3.2.6
> db.getCollectionNames()
[ "last_aggregated_stat_ids", "mapps", "stats", "system.indexes" ]
> db.mapps.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "app_development.mapps"
}
]
> db.stats.getIndexes()
2016-07-20T16:51:04.601+0200 E QUERY [thread1] TypeError: db.stats.getIndexes is not a function :
@(shell):1:1
关于会发生什么的任何想法?
得到他们
db.getCollection("stats").getIndexes()
https://docs.mongodb.com/manual/reference/method/db.stats/