-
Notifications
You must be signed in to change notification settings - Fork 341
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
collection.deleteMany() being called in a deprecated way, yielding a mongoDB Driver warning #422
Comments
Thanks for your information. Related issue in here: loopbackio/loopback-connector-mongodb#616 |
Somehow we need to wait for this PR: Ref link for future me: |
@mingchuno no more waiting - PR has been merged. |
hanks for getting hid fix in place. Because there isn't a new NPM package featuring this fix, I attempted to use it via the Git repo, but was stymied by a few issues including circular dependencies and unit test errors. I was able to address he dependencies and one type error as reported by eslint (part of he test stack) but was stymied by the unit est failures. Please refer to #428 for details |
v4.5.0 has been release, please try out @hillct |
I'm submitting a ...
[X ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
When used with a modern MongoDB driver (version 3.6.8 in this case but newer as well) we see this deprecation warning:
[MONGODB DRIVER] Warning: Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.
at emitWarning (node_modules/mongodb/lib/utils.js:851:17)
The fault lies with top level use of w and j parameters in a deprecated way here:
connect-mongo/src/lib/MongoStore.ts
Lines 235 to 239 in 6ba9af7
theoretically, there may be a way to introduce writeConcern via a constructor parameter passed into options.writeOperationOptions but I haven't been successful with that theoretical workaround so far, and it would just be a workaround anyway. The superior solution would be to call collection.deleteMany() in a non-deprecated way.
A review of he documentation https://docs.mongodb.com/manual/reference/write-concern/ suggests that seting the j parameter to true, would resolve the issue but I'm not sure which would be the optimal behavior for the particular session management goals of connect-mongo, nor am I a typeScript king of guy, so I leave it to the experts to determine the optimal parameter values here.
The text was updated successfully, but these errors were encountered: