[DOCS-6919] db.collection(collectionName).removeOne() not working as expected Created: 07/Jan/16  Updated: 30/Oct/23  Resolved: 06/Nov/17

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Stennie Steneker (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: mts
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

mongodb version 3.2

Location: https://docs.mongodb.org/v3.0/tutorial/remove-documents/
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Referrer: https://docs.mongodb.org/manual/tutorial/remove-documents/
Screen Resolution: 1600 x 900
repo: docs
source: tutorial/remove-documents


Participants:
Days since reply: 6 years, 14 weeks, 3 days ago

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



 Comments   
Comment by Stennie Steneker (Inactive) [ 06/Nov/17 ]

This issue is not reproducible with the current version of the Node.js driver (2.2.33).

The code examples in the Delete Documents tutorial have also been updated to reflect current Node driver API.

Generated at Thu Feb 08 07:53:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.