I\'m using MongoDB for our web application. Assume there will be a \'find()\' on MongoDB for incoming requests. What is the recommended way/place to add index on a MongoDB c
You could create a initialisation script for the collection to be run from the command line of your server (the Mongo docs discuss how to write Mongo scripts and run them from the CLI). Then have it run whenever mongod starts? The script could just call ensureIndex() on the collection object.