use salesDB
show db
db.createCollection("book")
db.book.insertOne({
name:"abc",
author:"jay"
})
db.book.insertMany([
{
name:"xyz",
author:"ram",
year:2678
},
{
name:"hgs",
author:"reva",
yera:678
}
])
db.book.find();
db.book.find({
year:{$gt :2000}
})
db.book.find({
id:1
})
db.book.insertMany([{
name:"anu",
author:"anu",
year:2021
},
{
name:"anu1",
author:"anu1",
year:2011
}
])
//Update a Single Document
db.book.updateOne(
{ name:"hgs"},
{ $set:{yera:2026}}
)
db.book.find(
{ yera:2026}
)
db.book.updateMany(
{ year:{$lt:2021}},
{$set:{author:"anuradha"}} )
db.book.find(
{
year:{$lte:2021}
}
)
db.book.find()
db.book.deleteOne(
{name:"jay"}
)
To embed this project on your website, copy the following code and paste it into your website's HTML: