Help! What does this error mean?

90 views
Skip to first unread message

Sherry Ummen

unread,
Aug 22, 2016, 8:53:43 AM8/22/16
to mongodb-user
Hi,

I am getting this error: "E11000 duplicate key error collection: TESTVLCC_SERVER.VERSIONS index: _id_ dup key: { : \"ST2/P*HULLA\" }", "n" : NumberLong(0), "updatedExisting" : false })

What does it mean?

Sherry

Sherry Ummen

unread,
Aug 26, 2016, 2:59:35 AM8/26/16
to mongodb-user
Wow so no one ever got this error?

Rhys Campbell

unread,
Aug 26, 2016, 4:17:50 AM8/26/16
to mongodb-user
You're trying to insert a duplicate record. You already have a record with that mentioned key in the id index.

Rhys
 

Sherry Ummen

unread,
Aug 26, 2016, 4:26:15 AM8/26/16
to mongodb-user
HI,

I am using Save method from C# driver which will check if the document is new then it will insert it or else will update it. So then I don understand how this can happen.

Sherry

Rhys Campbell

unread,
Aug 26, 2016, 4:30:26 AM8/26/16
to mongodb-user
Check your code or post it here. In your first post there's a bit which states...

 "updatedExisting" : false 


To me that says it's attempted an insert not an update.

Sherry Ummen

unread,
Aug 26, 2016, 4:43:09 AM8/26/16
to mongodb-user
The line which throws this exception is

  _versionsCollection.Save(masterDocument);

Rhys Campbell

unread,
Aug 26, 2016, 4:57:01 AM8/26/16
to mongodb-user
Not enough info to determine the problem / bug. I don;t know how the c# driver wraps it but you should be setting upsert to true.

Sherry Ummen

unread,
Aug 26, 2016, 8:38:01 AM8/26/16
to mongodb-user

Here is the call stack. Its calling Update, but after that too much of code to understand.


Sherry Ummen

unread,
Aug 26, 2016, 8:50:24 AM8/26/16
to mongodb-user
Looking at the code a bit looks like it was a Bulk Update operation with upsert flag to be true

Robert Stam

unread,
Aug 30, 2016, 9:38:25 AM8/30/16
to mongod...@googlegroups.com
It's likely you are running into this server issue:


When the document passed to the Save method already has an _id value the driver ends up doing an update with upsert : true. If multiple processes call Save on documents with the same _id value you could encounter this server issue.

A possible workaround is to retry the Save method when you get this particular exception.

On Fri, Aug 26, 2016 at 8:50 AM, Sherry Ummen <sherry...@gmail.com> wrote:
Looking at the code a bit looks like it was a Bulk Update operation with upsert flag to be true

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/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+unsubscribe@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/d4e4ef0b-4ffb-4138-ab42-2643c37fa734%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Sherry Ummen

unread,
Aug 31, 2016, 5:45:26 AM8/31/16
to mongodb-user
Thank you very much Robert. Ill do that.
Reply all
Reply to author
Forward
0 new messages