Nodejs MongoDB Create Collection

Node.js MongoDB Create Collection

MongoDB is a NoSQL database and it stores data in form of collection instead of table. A MongoDB collection is simply created using the createCollection method.

Example :- Let’s create MongoDB Collection named as “employees”

Step 1:-  Let’s, create a node_mongo_create_collection.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 –