Nodejs MongoDB Create Collection

In this tutorial you will learn about the Nodejs MongoDB Create Collection and its application with practical example.

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 –

Ooutput:-

Recommended:-  Nodejs Features
In this tutorial we have learn about the Nodejs MongoDB Create Collection and its application with practical example. I hope you will like this tutorial.