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"

    XMLWordPrintable

    Details

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

      Description

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: