title: Recommended way/place to create index on MongoDB collection for a web application
body: <p>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 collection ?</p>
  
  <p>Couple of options I can think of:-</p>
  
  <p>1) 'ensureIndex' on the collection while initializing the application. [But how will I 'ensureindex' at the very first time application initialize ? since there won't be any data in place]</p>
  
  <p>2 'ensureIndex' before every 'find' operation (on web request) ? but isn't this an overhead even if 'ensureIndex' wouldn't create index if it is already created ?</p>
  
  <p>Any other options ?</p>
  
  <p>Thanks in advance.</p>