A simple and basic CRUD application (Create, Read, Update, Delete) using Node.js, Express, MongoDB & EJS Templating Engine.
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:"Jainish Shah", age:27, email:"[email protected]"})
> db.users.insert({name:"Elon Mask", age:46, email:"[email protected]"})
> db.users.insert({name:"Jack Ma", age:53, email:"[email protected]"})
Query collection
> db.users.find().pretty()
{
"_id" : ObjectId("5acad2bc9cf54e14bc589de9"),
"name" : "Jainish Shah",
"age" : 27,
"email" : "[email protected]"
}
{
"_id" : ObjectId("5acad2c39cf54e14bc589dea"),
"name" : "Elon Mask",
"age" : 46,
"email" : "[email protected]"
}
{
"_id" : ObjectId("5acad2ca9cf54e14bc589deb"),
"name" : "Jack Ma",
"age" : 53,
"email" : "[email protected]"
}