Skip to content

Instantly share code, notes, and snippets.

@oisin
Created November 18, 2013 11:49
Show Gist options
  • Save oisin/7526544 to your computer and use it in GitHub Desktop.
Save oisin/7526544 to your computer and use it in GitHub Desktop.
Grab all the indexes from a Mongo instance
$ mongo host:port/db
MongoDB shell version: 2.2.3
connecting to: host:port/db
> db.auth('myuserid','mypassword')
1
> db.system.indexes.find()
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "db.system.users", "name" : "_id_" }
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "db.administrators", "name" : "_id_" }
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : db.apps", "name" : "_id_" }
{ "v" : 1, "key" : { "app_id" : 1 }, "unique" : true, "ns" : "db.apps", "name" : "app_id_1" }
{ "v" : 1, "key" : { "customer_id" : 1 }, "ns" : "db.apps", "name" : "customer_id_1" }
{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "db.audiences", "name" : "_id_" }
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment