Node JS - Node js MongoDB Remove - MongoDB delete records - MongoDB - Node - Node JS tutorial - webnode




How to Remove of MongoDB in Node.js?

  • The remove() method returns an object which contains information about how the execution affected the database.
  • In this, You can delete records, or documents as it is called in MongoDB, by using the remove() method.
  • learn nodejs - node-js tutorial - node js - mongodb delete statement - mongodb remove command - nodejs examples -  nodejs programs
  • The first parameter of the remove() method is a query object defining which documents to delete.
learn nodejs - node-js tutorial - node js mongodb insert sql - nodejs examples -  nodejs programs

Example

Remove the record of employee whose address is hussain. Create a js file named "remove.js", having the following code:

remove.js

var http = require('http');  
var MongoClient = require('mongodb').MongoClient;  
var url = "mongodb://localhost:27017/ MongoDatabase";  
MongoClient.connect(url, function(err, db) {  
if (err) throw err;  
var myquery = { address: 'hussian' };  
db.collection("employees").remove(myquery, function(err, obj) {  
if (err) throw err;  
console.log(obj.result.n + " record(s) deleted");  
db.close();  
});  
});  

Open the command terminal and run the following command: Node remove.js

Output:

 remove procedure of mongodb in node.js

Learn Node js - node js Tutorial - remove procedure of mongodb in node.js - node - Node js Examples

Related nodejs article tags - node js - node js tutorial - node js examples

Verification

You can check that the record having address "hussain" is deleted and only following records are available now:

 verification of  remove mongodb in node.js remove

Learn Node js - node js Tutorial - verification of remove mongodb in node.js remove - node - Node js Examples


This wikitechy technological portal provides you whole lot of information related to the topics such as mongodb tutorial , what is node js , express js tutorial , node js tutorial pdf , learn node js , node js tutorial for beginners , node js tutorial w3schools , node js express , javascript for beginners , node js express tutorial , node js tutorial point , node js book , node js server , note js , node js mongodb , what is node js used for , why node js , node tutorial , node js basics , tutorialspoint node js , node express , node js sample application , nodeschool , node js for beginners , express tutorial , node js application , use of node js , npm tutorial , node js org , node js training , node js online training , node js tutorial beginner , how to use node js , node js hello world , express node js , node js mongodb tutorial , nodejs http , why use node js

Related Searches to Node.js MongoDB Remove

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×