Node.js MongoDB Remove Record

Node.js MongoDB Remove Record

The remove() method is used to remove a record from a MongoDB collection, you have to pass search parameters using query object to specify the records to be removed.

Example :- Let’s remove a records from  “employees” collection where emp_name is “Keith”.

Step 1:-  Let’s, create a node_mongo_remove.js file and put the following code in it –

Step 2:- Save the code and open the terminal again, and type the following command in order to run the file.

you will see following output on terminal –

Output:-