Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.31 KB

README.md

File metadata and controls

68 lines (52 loc) · 1.31 KB

Node.js, Express & MongoDB: Simple Add, Edit, Delete, View (CRUD)

A simple and basic CRUD application (Create, Read, Update, Delete) using Node.js, Express, MongoDB & EJS Templating Engine.

Blog: Node.js, Express & MongoDB: Simple Add, Edit, Delete, View (CRUD)

Start MongoDB server

sudo service mongod start

Check MongoDB server status

sudo service mongod status

Go to MongoDB shell

mongod

Show databases

show dbs

Create database named "test"

use test

Create collection(table) named "users"

> db.users.insert({name:"Mukesh Chapagain", age:88, email:"[email protected]"})
> db.users.insert({name:"Raju Sharma", age:77, email:"[email protected]"})
> db.users.insert({name:"Krishna Yadav", age:65, email:"[email protected]"})

Query collection

> db.users.find().pretty()
{
	"_id" : ObjectId("5946517675f3fc671900a6c1"),
	"name" : "Mukesh Chapagain",
	"age" : 88,
	"email" : "[email protected]"
}
{
	"_id" : ObjectId("5946517f75f3fc671900a6c2"),
	"name" : "Raju Sharma",
	"age" : 77,
	"email" : "[email protected]"
}
{
	"_id" : ObjectId("5946518375f3fc671900a6c3"),
	"name" : "Krishna Yadav",
	"age" : 65,
	"email" : "[email protected]"
}