SlideShare une entreprise Scribd logo
1  sur  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………………
…………

Contenu connexe

Tendances

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
 

Tendances (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
 

En vedette

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
 

En vedette (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
 

Similaire à Mongo db modifiers

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

Similaire à 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
 

Dernier

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 

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" }