Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1312

dropping a non-existing collection throws error "MongoError: ns not found"

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: MongoDB 3.2
    • Environment:
      MongoDB 3.2 and driver version 3.0.1

      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);
          });
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            andresvelasco Andres
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: