Reputation: 150976
I think explain()
will tell any possible index it can use. How about just showing all the indexes defined on the collection? (or even for the whole db?)
Upvotes: 1
Views: 110
Reputation: 4964
Or use the collection name. I.e., if you have a users
collection do:
db.users.getIndexes()
Upvotes: 2
Reputation: 262474
>db.system.indexes.find();
>db.system.indexes.find( { ns: "tablename" } );
will give you something like
{
"ns" : "test.fs.chunks",
"key" : { "files_id" : 1, "n" : 1 },
"name" : "files_id_1_n_1"
}
for every index (ns
is the collection name).
Upvotes: 3