title: MongoDB : ensureIndex not working on both single key and composite keys
body: <p>From hours I'm trying to add bulk data in my locally setup MongoDB collection, all is set except unique index for a key or keys :(</p>
  
  <p>I've used this:</p>
  
  <pre><code>ensureIndex({appid:1, userid:1}, {unique:true, dropDups:true, background:true})
  </code></pre>
  
  <p>then this (coz I guess for whatever reason, multiple keys index is not working)</p>
  
  <pre><code>ensureIndex({userid:1}, {unique:true, dropDups:true, background:true})
  </code></pre>
  
  <p>after using above lines I tried to insert millions of rows from a php script (via both insert and batchInsert) and everytime duplicate userids are there :'( please please guide me on this :(</p>