Mongo DB connect with NodeJS



To start Mongodb:
1.create folder named( data ) and include that folder below.
2.D:\Mongodb\bin> mongod.exe --dbpath “D:\data”
Another cmd
3. mongo.exe

Function:
1..To create database:
use DATABASE_NAME
2..insert() 
>db.COLLECTION_NAME.insert(document)
3..Update() 
>db.COLLECTION_NAME.update(SELECTION_CRITERIA, UPDATED_DATA)
4..remove() 
>db.COLLECTION_NAME.remove(DELLETION_CRITTERIA)
5..To check data
>db.dbname.find().pretty()

To run Nodejs:
Go to the folder path and
1. npm install
2. npm i -g @angular/cli
3. ng serve or npm start or npm run dev

Share this

Related Posts

Previous
Next Post »

Pageviews from the past week