Skip to content

mkujaggi/Node-MongoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node-MongoDB

Fetch data from MongoDB using NodeJs ----- Setting Up MongoDB----------------

  1. Install Mongodb 2.create data\db folder as mongodb requires a data folder to store its files. -> md data -> cd data -> md db
  2. open command prompt and go to mongodb\bin path and give the following command to start the mongo process

mongod --dbpath "d:\data\db"

  1. open another command prompt and go to mongodb\bin path and give the following command to start the mongo shell

mongo

  1. In mongo shell, type the following commands

i. command to create/open a database -> use ex: use mydb mydb is the databsae name ii. command to create a collection -> db.createCollection("collectionname") ex: db.createCollection("Longiin") iii. command to insert a record/document -> db..insert(records); ex: db.Longiin.insert({name:"abc",email:"[email protected]"}); iv. command to display the records from a collection -> db..find() ex: db.Longiin.find() ---- starting Node---------

  1. open cmd and go to path where Login.js file is and tyep
  2. node login.js

  3. open login.html in browser and check with the values that are inserted in the database.

About

Fetch data from MongoDB using NodeJs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published