-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: MongoDB 3.2
-
Environment:MongoDB 3.2 and driver version 3.0.1
-
Empty show more show less
dropping a non-existing collection throws error "MongoError: ns not found"
I understand it should just do this successfully, especially because there is no reasonable way, I think, to check if the collection exists (it would be awkward to do findOne for instance).
Example code with which I get this:
var MongoClient = require ('mongodb').MongoClient; var client = null; MongoClient.connect ('mongodb://127.0.0.1:27017') .then ( function (res) { client = res; return (client.db ('mixie').collection ('user').drop (null)); }) .then ( function () { return (client.close (false)) }) .then ( function () { console.log ("OK"); }) .catch ( function (err) { console.log (err); });