0% found this document useful (0 votes)
20 views6 pages

Ex No 5

This document outlines the steps to create a NodeJS server using Express that performs CRUD operations on student details stored in a MongoDB database. It includes instructions for setting up the environment, installing necessary packages, and connecting to MongoDB. Additionally, it explains the program structure, including importing modules, creating a schema, and viewing inserted documents in the database.

Uploaded by

vanisris.mca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views6 pages

Ex No 5

This document outlines the steps to create a NodeJS server using Express that performs CRUD operations on student details stored in a MongoDB database. It includes instructions for setting up the environment, installing necessary packages, and connecting to MongoDB. Additionally, it explains the program structure, including importing modules, creating a schema, and viewing inserted documents in the database.

Uploaded by

vanisris.mca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

5.

Create a NodeJS server using Express that creates, reads, updates and deletes students'
details and stores them in MongoDB database. The information about the user should be
obtained from a HTML form.

Step 1: First we need to setup the environment.


Step 2: Create a new folder with any name (Ex: ExpressMongoDb).
Step 3: Command to create Nodejs project npm init -y
Step 4: Next install express, mongoose
Command: npm install express , npm install mongoose
Express – for server,
Mongoose – for database
Step 5: Run the program
Step 6: Open server at the port , Here localhost: 8000

Values inserted in the Database:

Program Explanation:
• First we are importing modules express and mongoose,
• Next we are connecting monodb by mongoose.connect() method. Copy the link
connection String in MongoDb Atlas at Drivers section.
• Next we are creating a Schema of our Collection and we are naming the collection as
“Students”.
• Next we are performing CRUD operations our Collection.
• Next we are viewing the all the documents inserted in Database.
• You can also view the inserted documents in the inserted Database.

You might also like