I have a sharded collection on _id with the unique constraint set on the shard key.
use config
switched to db config
mongos> db.collections.find()
{ "_id" : "production.people", "lastmod" : ISODate("1970-01-16T13:58:02.263Z"), "dropped" : false, "key" : { "_id" : 1 }, "unique" : true, "lastmodEpoch" : ObjectId("503e9d5ef940d75c2de07f8e") }
When i start sharding to a second shard i get duplicate documents in the database. some documents are on both shards. i really don't get why this should happen since _id key is unique.
could one of this things be a problem?
- The unique key in the _id field is an integer.
- We do lots of bulk inserts.
- We used autobalancing. Can i avoid the problem by splitting manually?
i would be glad if someone could help me with this.
dani