diff --git a/lib/db.js b/lib/db.js index 937efcd635..1e59ee3eeb 100644 --- a/lib/db.js +++ b/lib/db.js @@ -1042,6 +1042,7 @@ var createIndex = function(self, name, fieldOrSpec, options, callback) { // 86 = 'IndexKeySpecsConflict' (index already exists with the same name) // 11000 = 'DuplicateKey' (couldn't build unique index because of dupes) // 11600 = 'InterruptedAtShutdown' (interrupted at shutdown) + // 197 = 'InvalidIndexSpecificationOption' (`_id` with `background: true`) // These errors mean that the server recognized `createIndex` as a command // and so we don't need to fallback to an insert. if ( @@ -1049,7 +1050,8 @@ var createIndex = function(self, name, fieldOrSpec, options, callback) { err.code === 11000 || err.code === 85 || err.code === 86 || - err.code === 11600 + err.code === 11600 || + err.code === 197 ) { return handleCallback(callback, err, result); }