I have a couple of Ids in my mongodb database document. I need to create indexes on these Ids through a script so that i do not have to run the ensureIndex command again and again.
db.getCollection("elements").ensureIndex({customerId:1});
db.getCollection("elements").ensureIndex({userId:1});
........
I just run the script (that contains all these commands) and I should be done. Any idea how to run a script from mongodb shell? Also what should be the extension of the script?
Juhi.