-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix(base): allow global option mongoose.set('strictQuery', true); #9016
Conversation
to guard against failed tests not cleaning up after failing which will in turn cause more tests to fail, making it difficult to know the root cause of all the failing tests
let strictQueryOriginalValue; | ||
|
||
this.beforeEach(() => strictQueryOriginalValue = mongoose.get('strictQuery')); | ||
this.afterEach(() => mongoose.set('strictQuery', strictQueryOriginalValue)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vkarpov15 I'd like to know what you think of this approach.
I initially made the cleanup in each test, but if one of those tests had failed, the cleanup wouldn't have happened, causing more tests to fail, making it difficult to find the root cause of all the failing tests.
I think this mitigates this concern, but I still don't like it. How would you do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach is ok, but the better approach would be to create a new Mongoose instance using const _mongoose = new mongoose.Mongoose();
and use _mongoose.set()
. Check out the test for #6578 for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this attempt to create a new connection with the same URI for the database? Making tests run significantly slower?
…ror with `ordered: false`, even if only one op failed Re: Automattic#8938
…anchor docs: add anchor tag to strictQuery and strict
fix(documentarray): make sure you can call `unshift()` after `map()`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new feature, I'll merge this into the 5.10 branch. Since the mongodb driver looks like they're going to do a 3.6 release before their 4.0 release, we should do a 5.10 release before 6.0.
fixes #6658 for strictQuery