db = db.getSisterDB("myDatabase");
var bulk = db.privilege.initializeOrderedBulkOp();bulk.insert( { _id: 1, name: "a", key: "l" } );bulk.insert( { _id: 2, name: "b", key: "m" } );bulk.insert( { _id: 3, name: "c", key: "n" } );bulk.insert( { _id: 4, name: "d", key: "o" } );bulk.insert( { _id: 5, name: "e", key: "p" } );bulk.insert( { _id: 6, name: "f", key: "q" } );bulk.insert( { _id: 7, name: "g", key: "r" } );bulk.insert( { _id: 8, name: "h", key: "s" } );bulk.insert( { _id: 9, name: "i", key: "t" } );bulk.insert( { _id: 10, name: "j", key: "u" } );bulk.insert( { _id: 11, name: "k", key: "v" } );bulk.execute();
2015-03-11T13:42:40.316-0700 BulkWriteError({ "writeErrors" : [ { "index" : 0, "code" : 11000, "errmsg" : "E11000 duplicate key error index: myDatabase.privilege.$_id_ dup key: { : 1.0 }", "op" : { "_id" : 1, "name" : "a", "key" : "l" } } ], "writeConcernErrors" : [ ], "nInserted" : 0, "nUpserted" : 0, "nMatched" : 0, "nModified" : 0, "nRemoved" : 0, "upserted" : [ ]}) at src/mongo/shell/bulk_api.js:1154
db.privilege.ensureIndex( { name: 1 }, { unique: true } )db.privilege.ensureIndex( { key: 1 }, { unique: true } )
> db.privilege.ensureIndex( { name: 1 }, { unique: true } ){ "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "errmsg" : "exception: E11000 duplicate key error index: octolytics.privilege.$name_1 dup key: { : null }", "code" : 11000, "ok" : 0}> db.privilege.ensureIndex( { key: 1 }, { unique: true } ){ "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "errmsg" : "exception: E11000 duplicate key error index: octolytics.privilege.$key_1 dup key: { : null }", "code" : 11000, "ok" : 0}
What's in this collection? If there is no data I'd say drop it and start from scratch...
Could you check what the output of db.system.namespaces.find() in that DB is?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/55f3e4be-0aed-4ec1-94a2-7cdecca1e541%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.