Skip to content

Commit

Permalink
fix(db): throw readable error when creating _id with background: true
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Jun 18, 2018
1 parent ad03190 commit b3ff3ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/operations/db_ops.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,15 @@ function createIndex(db, 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`)
*/
if (
err.code === 67 ||
err.code === 11000 ||
err.code === 85 ||
err.code === 86 ||
err.code === 11600
err.code === 11600 ||
err.code === 197
) {
return handleCallback(callback, err, result);
}
Expand Down

0 comments on commit b3ff3ed

Please sign in to comment.