I'm trying to get the index of a collection.

> db.version()

> 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 :

Any ideas of what can happen?

1 Answer 1


db.stats() is a function call so db.stats is a function reference which has no function called getIndexes().

To get them db.getCollection("stats").getIndexes()


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.