Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead
Asked Answered
I

2

9

I am using mongodb with loopback and on successful connection I am getting below warning

Top-level use of w, wtimeout, j, and fsync is deprecated. Use writeConcern instead.

loopback version: 5.5.0

How to get rid of this? Kindly help

Immense answered 25/2, 2021 at 18:55 Comment(0)
S
5

Apparently this warning was introduced in Mongo Driver v3.6.4 so the basis solution will be to down grade to v3.6.3. There is a PR that try to stop the warning outputs, and also a report on the Jira for the Node Driver. https://jira.mongodb.org/browse/NODE-3114

Update: The problem have been fixed with the version 3.6.5

Silvas answered 25/2, 2021 at 21:39 Comment(8)
Thanks... So warning will be removed the next mongodb version. Right?Immense
@Immense The problem should be fixed, i will keep this post updated about it.Silvas
I see this same exact warning suddenly popping out of no whereFinegrain
Hey how to update to version 3.6.5? Still showing me the latest version is 3.6.4.Farl
No matching version found for [email protected]Chloras
I have to apologize to everyone, the fix will be available when they released 3.6.5 github.com/mongodb/node-mongodb-native/commit/…Silvas
i updated to 3.6.5 but problem is still thereDetention
@BasitMinhas There is a probability that this warning comes from some module/package that still uses an old version of the MongoDB driver and not from your code.Artemus
T
5

Pass the following options

mongoose.connect(process.env.MONGO_URI, { 
  useNewUrlParser: true,
  useFindAndModify: false,
  useUnifiedTopology: true,
  useCreateIndex: true 
})
Tanto answered 2/4, 2021 at 20:14 Comment(1)
Welcome to Stack Overflow. Dear @Tanto please answer questions with more details. Thanks!Springing

© 2022 - 2024 — McMap. All rights reserved.