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
StrictModeError: Path "$comment" is not in schema, strict mode is true
, and upsert is true
#14576
Comments
UPD
throws
We are lucky we don't use Maybe it should be fixed for all the cases? I mean, to allow passing P.S.
|
As of March 1st, we no longer support support 5.x https://mongoosejs.com/docs/version-support.html |
Didn't see that last part about the newer versions having the same issue. Sorry about that. |
@IslandRhythms np. Tnx! I wanted to try to upgrade to a newer version, but the issue exists on all the versions :/ Tried to bypass it by using Anyway, if it will be fixed on newer version, I'll have more reasons to push upgrade in production. |
fix(cast): cast $comment to string in query filters
Fix will be in v6.12.9. Mongoose 5.x is no longer maintained, please check out out guide to migrating from Mongoose 5 to Mongoose 6. |
Prerequisites
Mongoose version
5.9.7
Node.js version
12.x
MongoDB server version
3.5.5
Typescript version (if applicable)
No response
Description
Upgraded Mongoose to the latest 5.* version and tests failed. After diving in, I did find a breaking change which doesn't make sense to me.
This new behaviour was introduced in mongoose v5.9.7 and I think it was in this PR - #8698
I didn't expect the
$comment
to be interpreted as a field of the model.From MongoDB documentation (https://www.mongodb.com/docs/manual/reference/operator/query/comment/)
You can check that in mongoose v5.9.5 it will work and you will see in db logs the queries:
Steps to Reproduce
As result, it will fail with
Expected Behavior
As per mongodb documentation, $comment should be passed to MongoDB and it will be logged.
P.S.
Newer versions are broken as well. Tested: 8.3.4, 7.6.11, 6.12.8
The text was updated successfully, but these errors were encountered: