With v1.8.1:
MongoDB shell version: 1.8.1
connecting to: odyssey_test
> use foo_test
switched to db foo_test
> db.users.ensureIndex({aliases:1},{sparse:true,unique:true})
> db.users.insert({name:"alice", aliases:[]})
> db.users.insert({name:"bob", aliases:[]})
> db.users.find()
{ "_id" : ObjectId("4e7b5b219521a5c75ce16608"), "name" : "alice", "aliases" : [ ] }
{ "_id" : ObjectId("4e7b5b289521a5c75ce16609"), "name" : "bob", "aliases" : [ ] }
with v2.0.0:
MongoDB shell version: 2.0.0
connecting to: test
> use foo_test
switched to db foo_test
> db.users.ensureIndex({aliases:1},{sparse:true,unique:true})
> db.users.insert({name:"alice", aliases:[]})
> db.users.insert({name:"bob", aliases:[]})
E11000 duplicate key error index: foo_test.users.$aliases_1 dup key: { : undefined }
If I instead create the index with v:0 (to force old-style, pre-v2.0 index type), I don't get the dup key error, i.e. same behaviour as 1.8 (as you would expect).
Is this intended behaviour? I don't see anything in release notes…
Thanks,
Ben
Can you create a bug report at jira.mongodb.org? This seems like a bug.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/H_u2v41D_C0J.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.