Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-6919

db.collection(collectionName).removeOne() not working as expected

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual, Server

    Description

      var MongoClient1 = require('mongodb').MongoClient;
      MongoClient1.connect("mongodb://localhost:27017/test", function(err, db) {
      if(err)console.log("err",err)
      //this is not working but deleting all records
      db.collection(colName).removeOne({ "del" : "true" },1,function(){
        db.close()
      })
      //this is working good and deleting only first record.
      db.collection(colName).removeOne({ "del" : "true" },function(){
        db.close()
      })
      

      Attachments

        Activity

          People

            stephen.steneker@mongodb.com Stennie Steneker (Inactive)
            xgen-internal-docs Docs Collector User (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              6 years, 14 weeks, 3 days ago