I'm trying to drop a non existant collection and I get the following error:
MongoError: ns not found.
In a similar question, there is a link to the mongo code which shows that this is the expected behaviour:
MongoError: ns not found when try to drop collection
However, according to the mongo documentation, this method should return false if the collection does not exists:
https://docs.mongodb.com/manual/reference/method/db.collection.drop/#db.collection.drop
What am I missing?
Server version - 3.6.5, mongodb client (javascript) - 3.0.21
The commands I used:
await mongodb.collection('colname').drop()
and
mongodb.collection('colname').drop((err, res) => {
console.log('err: ' + err + ', res: ' + res) // doesn't get called
})