I want to setup compound index on fb_id and ts in my mongoDB. So, I did:
PRIMARY> db.sessions.ensureIndex( { fb_id: 1, ts: 1 }, { unique:true } );
But I got following error:
E11000 duplicate key error index: tracking.sessions.$fb_id_1_ts_1 dup key: { : null, : null }
So I checked the indexes in this collection using db.sessions.getIndexes()
, I got:
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "tracking.sessions",
"name" : "_id_"
}
]
It doesn't look like a duplicate key to me. What am I doing wrong here?