-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Schema with writeConcern set results in createIndex triggering "top-level use of w, wtimeout" deprecation notice #10083
Comments
I believe this was fixed on the most recent version of mongoose |
I am not sure that is was fully fixed, see #10009 (comment). |
I've got the full stack trace of warning (node:71419) [MONGODB DRIVER] Warning: Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.
at emitWarning (/app/node_modules/mongodb/lib/utils.js:844:17)
at Object.emitWarningOnce (/app/node_modules/mongodb/lib/utils.js:863:12)
at Function.fromOptions (/app/node_modules/mongodb/lib/write_concern.js:82:11)
at resolveWriteConcern (/app/node_modules/mongodb/lib/operations/command_v2.js:112:23)
at new CommandOperationV2 (/app/node_modules/mongodb/lib/operations/command_v2.js:25:25)
at new CreateIndexesOperation (/app/node_modules/mongodb/lib/operations/create_indexes.js:46:5)
at Collection.createIndex (/app/node_modules/mongodb/lib/collection.js:1247:34)
at NativeCollection.<computed> [as createIndex] (/app/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:218:28)
at NativeCollection.create (/app/node_modules/mongoose/lib/model.js:1667:33)
at NativeCollection.Collection.doQueue (/app/node_modules/mongoose/lib/collection.js:137:17)
at /app/node_modules/mongoose/lib/collection.js:82:24
at processTicksAndRejections (internal/process/task_queues.js:75:11) mongoose: 5.12.3 |
It appears that this issue persists, in Mongoose 5.12.13 yielding the following stack trace: (node:9572) [MONGODB DRIVER] Warning: Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead. also mentioned in the race is connect-mongo which is at 4.4.1 bu it's not clear to me that's material to this issue - included here for completeness. |
Could you please provide the repro script you are using to get that warning |
I don't currently have a minimum viable example reproducing this issue. I'll see about stripping down our codebase to something that can be released for this purpose, over the weekend. UPDATE: I wasn't able to allocate time to this over the weekend. I'm currently targeting Wednesday to work on an minimalist example. From the trace, I'm guessing it relates to external use of the Mongoose client promise (which is what connect-mongo is doing). |
@hillct this is an issue with connect-mongo, here's the relevant source code: https://github.com/jdesboeufs/connect-mongo/blob/6ba9af7978b5a745a501ab7faf55d1d563d876c9/src/lib/MongoStore.ts#L235-L239 . TLDR; connect-mongo is using top-level |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Having a schema with write concern results in a deprecation notice for each index creation for that schema.
If the current behavior is a bug, please provide the steps to reproduce.
Schema options:
{ writeConcern: { w: 1 } }
with at least one indexed fieldWhat is the expected behavior?
Should have no deprecation notice due to new format
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node v12.20.2
Mongoose 5.11.20
Mongodb 3.4
Additional Notes
This is appears to be a different codepath than #10009
On a side note, there also appears to be an issue with the mongodb-native-driver giving erroneous deprecation notices for writeConcern specifically, so I've got a PR open there. mongodb/node-mongodb-native#2773
The text was updated successfully, but these errors were encountered: