Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 490
Profer Avatar asked Feb 25 '21 18:02

Profer


2 Answers

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

like image 102
Haniel Baez Avatar answered Oct 26 '22 06:10

Haniel Baez


Pass the following options

mongoose.connect(process.env.MONGO_URI, { 
  useNewUrlParser: true,
  useFindAndModify: false,
  useUnifiedTopology: true,
  useCreateIndex: true 
})
like image 4
Unpredict2ble Avatar answered Oct 26 '22 08:10

Unpredict2ble