SlideShare ist ein Scribd-Unternehmen logo
1 von 6
MongoDB Modifier’s
Modifiers
$inc> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 32
}
Increment the uName=anish age to 1
> db.user.update({"_id" :
ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$inc" : {"age" :
1}})
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 33
}
$set
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 33
}
Set the uName=anish age to 31
> db.user.update({"_id" :
ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$set" : {"age" : 31}})
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 31,
}
$unset
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 33
}
Remove the age key
> db.user.update({"_id" :
ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$unset" : {"age" : 31}})
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"uName" : "anish"
}
$PUSHAdd a array to the exisitng document
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"uName" : "anish",
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"age" : 33
}
PUSH the remark array in the document
db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")}, {$push : {"remarks" : {"name":"anish","rate":"good"}}})
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"remarks" : [
{
"name" : "anish",
"rate" : "good"
}
],
"uName" : "anish"
}
Add existing to the remarks array
> db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")}, {$push : {"remarks" : {"name":"nath","rate":"bad"
> db.user.findOne()
{
"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"),
"date" : ISODate("2013-03-10T11:30:50.555Z"),
"remarks" : [
{
"name" : "anish",
"rate" : "good"
},
{
"name" : "nath",
"rate" : "bad"
}
],
"uName" : "anish"
}
Thanks for Watching
feedback
appreciated………………
…………

Weitere ähnliche Inhalte

Was ist angesagt?

You Don't Need Lodash
You Don't Need Lodash You Don't Need Lodash
You Don't Need Lodash
UpsideTravel
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
kchodorow
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
MongoDB
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance Debugging
MongoDB
 

Was ist angesagt? (20)

Books
BooksBooks
Books
 
You Don't Need Lodash
You Don't Need Lodash You Don't Need Lodash
You Don't Need Lodash
 
Mongo db updatedocumentusecases
Mongo db updatedocumentusecasesMongo db updatedocumentusecases
Mongo db updatedocumentusecases
 
MongoDB
MongoDBMongoDB
MongoDB
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
San Francisco Java User Group
San Francisco Java User GroupSan Francisco Java User Group
San Francisco Java User Group
 
Mobile Web 5.0
Mobile Web 5.0Mobile Web 5.0
Mobile Web 5.0
 
MongoDB dla administratora
MongoDB dla administratora MongoDB dla administratora
MongoDB dla administratora
 
20110514 mongo dbチューニング
20110514 mongo dbチューニング20110514 mongo dbチューニング
20110514 mongo dbチューニング
 
Couchdb
CouchdbCouchdb
Couchdb
 
Database Wizardry for Legacy Applications
Database Wizardry for Legacy ApplicationsDatabase Wizardry for Legacy Applications
Database Wizardry for Legacy Applications
 
はじめてのMongoDB
はじめてのMongoDBはじめてのMongoDB
はじめてのMongoDB
 
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
Webinarserie: Einführung in MongoDB: “Back to Basics” - Teil 3 - Interaktion ...
 
MongoDB Performance Debugging
MongoDB Performance DebuggingMongoDB Performance Debugging
MongoDB Performance Debugging
 
Querying mongo db
Querying mongo dbQuerying mongo db
Querying mongo db
 
MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !MongoDB Aggregation Framework in action !
MongoDB Aggregation Framework in action !
 
ggplot2 extensions-ggtree.
ggplot2 extensions-ggtree.ggplot2 extensions-ggtree.
ggplot2 extensions-ggtree.
 
Time Code: Automating Tasks in WordPress with WP-Cron
Time Code: Automating Tasks in WordPress with WP-CronTime Code: Automating Tasks in WordPress with WP-Cron
Time Code: Automating Tasks in WordPress with WP-Cron
 
Back to Basics: My First MongoDB Application
Back to Basics: My First MongoDB ApplicationBack to Basics: My First MongoDB Application
Back to Basics: My First MongoDB Application
 

Andere mochten auch

1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
jeeva indra
 
Assignment2 2 laurenminnick
Assignment2 2 laurenminnickAssignment2 2 laurenminnick
Assignment2 2 laurenminnick
Lauren Minnick
 
Assignment1 1 elizabethminnick
Assignment1 1 elizabethminnickAssignment1 1 elizabethminnick
Assignment1 1 elizabethminnick
Lauren Minnick
 
Assignment1 2 elizabethminnick (1)
Assignment1 2 elizabethminnick (1)Assignment1 2 elizabethminnick (1)
Assignment1 2 elizabethminnick (1)
Lauren Minnick
 
Minnick ch10 presentation
Minnick ch10 presentationMinnick ch10 presentation
Minnick ch10 presentation
Lauren Minnick
 
Cluster based routing protocol
Cluster based routing protocolCluster based routing protocol
Cluster based routing protocol
Sudhansu Dash
 
Presentación1animking
Presentación1animkingPresentación1animking
Presentación1animking
colo22-22
 
Presentación4
Presentación4Presentación4
Presentación4
colo22-22
 
El calentamiento global
El calentamiento globalEl calentamiento global
El calentamiento global
tonymauco
 

Andere mochten auch (20)

1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
Assignment2 2 laurenminnick
Assignment2 2 laurenminnickAssignment2 2 laurenminnick
Assignment2 2 laurenminnick
 
Assignment1 1 elizabethminnick
Assignment1 1 elizabethminnickAssignment1 1 elizabethminnick
Assignment1 1 elizabethminnick
 
Assignment3 1 minnick
Assignment3 1 minnickAssignment3 1 minnick
Assignment3 1 minnick
 
Powerpoint Project - Daniel Aguiar
Powerpoint Project - Daniel AguiarPowerpoint Project - Daniel Aguiar
Powerpoint Project - Daniel Aguiar
 
Better burger
Better burgerBetter burger
Better burger
 
Assignment1 2 elizabethminnick (1)
Assignment1 2 elizabethminnick (1)Assignment1 2 elizabethminnick (1)
Assignment1 2 elizabethminnick (1)
 
Minnick ch10 presentation
Minnick ch10 presentationMinnick ch10 presentation
Minnick ch10 presentation
 
Foriegn body upper GI tract -role of endoscopy.
Foriegn body upper GI tract -role of endoscopy.Foriegn body upper GI tract -role of endoscopy.
Foriegn body upper GI tract -role of endoscopy.
 
Factores de crecimiento y periodoncia
Factores de crecimiento y periodonciaFactores de crecimiento y periodoncia
Factores de crecimiento y periodoncia
 
Assignment3 3 minnick
Assignment3 3 minnickAssignment3 3 minnick
Assignment3 3 minnick
 
UNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENTUNRAVEILING BIT-TORRENT
UNRAVEILING BIT-TORRENT
 
The Corners of Lisbon - Bespoke Tours
The Corners of Lisbon - Bespoke ToursThe Corners of Lisbon - Bespoke Tours
The Corners of Lisbon - Bespoke Tours
 
Cluster based routing protocol 1
Cluster based routing protocol 1Cluster based routing protocol 1
Cluster based routing protocol 1
 
Cluster based routing protocol
Cluster based routing protocolCluster based routing protocol
Cluster based routing protocol
 
Presentación1animking
Presentación1animkingPresentación1animking
Presentación1animking
 
Presentación4
Presentación4Presentación4
Presentación4
 
El calentamiento global
El calentamiento globalEl calentamiento global
El calentamiento global
 
A crise na educação
A crise na educaçãoA crise na educação
A crise na educação
 
Elamor yamistad cccc
Elamor yamistad ccccElamor yamistad cccc
Elamor yamistad cccc
 

Ähnlich wie Mongo db modifiers

First app online conf
First app   online confFirst app   online conf
First app online conf
MongoDB
 

Ähnlich wie Mongo db modifiers (20)

MongoDB With Style
MongoDB With StyleMongoDB With Style
MongoDB With Style
 
How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6How to leverage what's new in MongoDB 3.6
How to leverage what's new in MongoDB 3.6
 
MongoDB
MongoDBMongoDB
MongoDB
 
Mongo db readingdocumentusecases
Mongo db readingdocumentusecasesMongo db readingdocumentusecases
Mongo db readingdocumentusecases
 
MongoDB-SESSION03
MongoDB-SESSION03MongoDB-SESSION03
MongoDB-SESSION03
 
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and JavaBuilding a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
 
Schema design
Schema designSchema design
Schema design
 
Practical MongoDB
Practical MongoDBPractical MongoDB
Practical MongoDB
 
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Houston 2019: Best Practices for Working with IoT and Time-ser...
 
Mongo db for c# developers
Mongo db for c# developersMongo db for c# developers
Mongo db for c# developers
 
Back to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB ApplicationBack to Basics 2017 - Your First MongoDB Application
Back to Basics 2017 - Your First MongoDB Application
 
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
MongoDB .local Chicago 2019: Best Practices for Working with IoT and Time-ser...
 
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series DataMongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
MongoDB SoCal 2020: Best Practices for Working with IoT and Time-series Data
 
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
MongoDB .local Munich 2019: Best Practices for Working with IoT and Time-seri...
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Building Apps with MongoDB
Building Apps with MongoDBBuilding Apps with MongoDB
Building Apps with MongoDB
 
MongoD Essentials
MongoD EssentialsMongoD Essentials
MongoD Essentials
 
First app online conf
First app   online confFirst app   online conf
First app online conf
 
MongoDB
MongoDBMongoDB
MongoDB
 
Elasticsearch first-steps
Elasticsearch first-stepsElasticsearch first-steps
Elasticsearch first-steps
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Mongo db modifiers

  • 2. $inc> db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 32 } Increment the uName=anish age to 1 > db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$inc" : {"age" : 1}}) > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 33 }
  • 3. $set > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 33 } Set the uName=anish age to 31 > db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$set" : {"age" : 31}}) > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 31, }
  • 4. $unset > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 33 } Remove the age key > db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")},{"$unset" : {"age" : 31}}) > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "date" : ISODate("2013-03-10T11:30:50.555Z"), "uName" : "anish" }
  • 5. $PUSHAdd a array to the exisitng document > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "uName" : "anish", "date" : ISODate("2013-03-10T11:30:50.555Z"), "age" : 33 } PUSH the remark array in the document db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")}, {$push : {"remarks" : {"name":"anish","rate":"good"}}}) > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "date" : ISODate("2013-03-10T11:30:50.555Z"), "remarks" : [ { "name" : "anish", "rate" : "good" } ], "uName" : "anish" } Add existing to the remarks array > db.user.update({"_id" : ObjectId("513c6ef1cfce9090d3fd8b1d")}, {$push : {"remarks" : {"name":"nath","rate":"bad" > db.user.findOne() { "_id" : ObjectId("513c6ef1cfce9090d3fd8b1d"), "date" : ISODate("2013-03-10T11:30:50.555Z"), "remarks" : [ { "name" : "anish", "rate" : "good" }, { "name" : "nath", "rate" : "bad" } ], "uName" : "anish" }