'How to disable MongoDB deprecation warnings
I use Node with Monk, a simple library for MongoDB. It doesn't have insertOne
and so on. And it's totally annoying to get a deprecation warning on each insert
. Does MongoDB have an option to disable deprecation warnings?
(node:17737) DeprecationWarning: collection.insert is deprecated. Use insertOne, insertMany or bulkWrite instead.
Solution 1:[1]
You didn't add your node code (and lots of time has passed) but for future answer searchers - some mongoose methods can receive a SaveOptions object.
ie. when using collection.save
you can pass this in like so:
doc.save({ suppressWarning: true })
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ghosh |