-
Notifications
You must be signed in to change notification settings - Fork 3
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
createIndex background
option is obsolete for mongo 4.2+
#70
Comments
We will need to be more careful now with this new index building behavior. Previously:
This is no longer an option. This means that the index constraints (such as uniqueness) will not be enforced until the index is finished building and, while it's being built, those constraints will not be enforced:
https://docs.mongodb.com/manual/core/index-creation/#constraint-violations-during-index-build I'm not sure what this means for our applications during startup, particularly those that rely on duplicate exceptions. We haven't seen any problems yet, but it sounds like that's only because of a combination of timing and the limited number of cases where we do that sort of thing. |
I have just confirmed that the mongodb 3.5.x driver functions as expected. That is, that the following will throw an error if there are database entries to violate a new index. The MongoDB docs state that the server builds the index and THEN checks for key violations. This suggests to me that awaiting the
An error like this one is properly produced if there is a unique key violation:
As for errors that are thrown in Bedrock event handlers where our mongo indexing takes place, we have long standing issues there, see: digitalbazaar/bedrock#78 |
See: https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options-for-all-index-types
Server reports when it sees the option
We can start removing our usage of the
backround
option.The text was updated successfully, but these errors were encountered: