Skip to content

Conversation

@futurist
Copy link

The duplicate may from arguments passed from user:

    autoIncrement.getNextSequence(db, 'test', 'ID', function(e, ID) {})
    ... ...
    autoIncrement.getNextSequence(db, 'test', 'ID2', function(e, ID) {})

Before this PR, ID2 will never show any errors, but the program hang, because the error message is:

{
  name: 'MongoError',
  message: 'E11000 duplicate key error index: test3.counters.$_id_ dup key: { : "test" }',
  ok: 0,
  errmsg: 'E11000 duplicate key error index: test3.counters.$_id_ dup key: { : "test" }',
  code: 11000
}

See, the error code is also 11000, but should throw in this case.

The duplicate may from arguments passed from user:

``` javascript
    autoIncrement.getNextSequence(db, 'test', 'ID', function(e, ID) {})
    ... ...
    autoIncrement.getNextSequence(db, 'test', 'ID2', function(e, ID) {})

```

Before this PR, `ID2` will never show any errors, but the program hang, because the error message is:

```
{
  name: 'MongoError',
  message: 'E11000 duplicate key error index: test3.counters.$_id_ dup key: { : "test" }',
  ok: 0,
  errmsg: 'E11000 duplicate key error index: test3.counters.$_id_ dup key: { : "test" }',
  code: 11000
}
```
See, the error code is also `11000`, but should throw in this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant