Skip to content

Commit 1cbfb5f

Browse files
committed
modify regex to correctly detect duplicate key _id field in recent mongodb server versions
1 parent 54f86e1 commit 1cbfb5f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ ShareDbMongo.prototype._writeSnapshot = function(collectionName, id, snapshot, o
225225
if (err) {
226226
// Return non-success instead of duplicate key error, since this is
227227
// expected to occur during simultaneous creates on the same id
228-
if (err.code === 11000 && /\.\$_id_ /.test(err.message)) {
228+
if (err.code === 11000 && /\b_id_\b/.test(err.message)) {
229229
return callback(null, false);
230230
}
231231
return callback(err);

0 commit comments

Comments
 (0)