How to remove a document from MongoDB in Node.js

In this tutorial I will speak about MongoDB. I will explain how to remove a document from MongoDB in Node.js. I hope you have seen my last tutorials about MongoDB and Node.js.

First of all, I will create a new JS file, called js.js.

In the file js.js, I will add this code:

var MongoClient = require('mongodb').MongoClient;

// Connect to the db
MongoClient.connect("mongodb://", function(err, db) {

// Connect to the collection

var collection = db.collection('demodb');

// Remove a document where number is 1



Now, I will start command line and enter: node js.js

I have created also a video tutorial:

Leave a Comment