Mongo db + Express + Angular + Node = MEAN
Stack Tutorial in Hindi #4 Mongo DB
Youtube
Column1 Column3
run mongod in powershell
run mongo in another power shell
use rocky => it will create a databse if it doesn't exist
use rocky otherwise it will switch to that database
show dbs will show all the dabases( will not show
Show dbs empty databases)
db.text will create a file with the name of database.txt
db.text.insert({}) empty database
db.text.insert({"name":"rakesh"}) insert into table "text"
show collections will show tables name in the database
db.items.find() will show the rows in the table "items"
insert one record into table "items"
db.items.insertOne({ name: "Samsung 30s", price:
22000, rating: 4.5, qty: 233, sold: 98 })
insert many records into table "items"
db.items.insertMany([{ name: "Samsung 30s", price:
22000, rating: 4.5, qty: 233, sold: 98 }, { name: "Moto
30s", price: 29000, rating: 3.5, qty: 133, sold: 598 },
{ name: "Realme 80s", price: 129000, rating: 2.5, qty:
633, sold: 98, isBig: true }])
right click in power shell to paste
db.items.find({rating: 3.5}) rating equalto 3.5
db.items.find({rating: {$gt:3.5}}) rating greater than 3.5
db.items.find({rating: {$gte:3.5}}) rating greater or equal to 3.5
db.items.find({ $or : [ {rating: { $gte: 3.5 }} ,
{price: { $gte: 25000 }} ]}) OR OPERATOR
db.items.find({ rating: { $gte: 3.5 }, price: { $gte:
25000 } }) AND OPERATOR used as comma
db.items.find( { rating: { $gte: 3.5 }, price: { $gte:
25000 } } ,{qty:1} ) only column qty will be shown for satisfying rows
db.items.deleteOne({price:22000}) //it will delete one (first) occurance
db.items.deletemany({price:22000}) //it will delete many
db.items.updateOne({ name: "Moto 30s" }, { $set:
{ price: 27000 } }) //UPDATE ONE
db.items.updateMany({ name: "Moto 30s" }, { $set: //Update Many
{ price: 27000 } })
Mongoose uses to connect Mongodb to NODE.JS
Mongo compass Downloads me pada hai..
const dotenv=require()
DB_CONNECT = "{connection string}" to store and access sensitive information like username and password
ke username and password