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 :(
I've used this:
ensureIndex({appid:1, userid:1}, {unique:true, dropDups:true, background:true})
then this (coz I guess for whatever reason, multiple keys index is not working)
ensureIndex({userid:1}, {unique:true, dropDups:true, background:true})
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 :(