Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two calls to createIndex when using with two collections? #85

Open
dandv opened this issue Apr 15, 2020 · 0 comments
Open

Two calls to createIndex when using with two collections? #85

dandv opened this issue Apr 15, 2020 · 0 comments

Comments

@dandv
Copy link
Contributor

dandv commented Apr 15, 2020

Thanks for the solution to #83! I'm using that to add autoincrementing fields to two collections:

@plugin(AutoIncrement, { inc_field: 'fooId', start_seq: 200 })
export class Foo extends defaultClasses.TimeStamps {
  ...
}

// In another file
@plugin(AutoIncrement, { inc_field: 'barId', start_seq: 500 })
export class Bar extends defaultClasses.TimeStamps {
  ...
}

I've enabled mongoose debugging and saw two calls to counters.createIndex:

Mongoose: counters.createIndex({ id: 1, reference_value: 1 }, { unique: true, background: true })
Mongoose: counters.createIndex({ id: 1, reference_value: 1 }, { unique: true, background: true })

Just wanted to check if this is expected. Would one call be enough? Thanks!

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

No branches or pull requests

1 participant