SlideShare a Scribd company logo
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………………
…………

More Related Content

PPTX
Mongo db query docuement
PDF
MongoDB全機能解説2
PDF
MongoDBで作るソーシャルデータ新解析基盤
PPTX
Basic crud operation
TXT
Litebox
PDF
MySQL flexible schema and JSON for Internet of Things
PDF
Embedding a language into string interpolator
Mongo db query docuement
MongoDB全機能解説2
MongoDBで作るソーシャルデータ新解析基盤
Basic crud operation
Litebox
MySQL flexible schema and JSON for Internet of Things
Embedding a language into string interpolator

What's hot (20)

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

Viewers also liked (20)

PDF
1336333055 php tutorial_from_beginner_to_master
PPTX
Assignment2 2 laurenminnick
PDF
Assignment1 1 elizabethminnick
PPTX
Assignment3 1 minnick
PPT
Powerpoint Project - Daniel Aguiar
PPTX
Better burger
PDF
Assignment1 2 elizabethminnick (1)
PPTX
Minnick ch10 presentation
PPTX
Foriegn body upper GI tract -role of endoscopy.
DOCX
Factores de crecimiento y periodoncia
PDF
Assignment3 3 minnick
PPTX
UNRAVEILING BIT-TORRENT
PDF
The Corners of Lisbon - Bespoke Tours
PPTX
Cluster based routing protocol 1
PPTX
Cluster based routing protocol
PPTX
Presentación1animking
PPTX
Presentación4
PPTX
El calentamiento global
PDF
A crise na educação
PPT
Elamor yamistad cccc
1336333055 php tutorial_from_beginner_to_master
Assignment2 2 laurenminnick
Assignment1 1 elizabethminnick
Assignment3 1 minnick
Powerpoint Project - Daniel Aguiar
Better burger
Assignment1 2 elizabethminnick (1)
Minnick ch10 presentation
Foriegn body upper GI tract -role of endoscopy.
Factores de crecimiento y periodoncia
Assignment3 3 minnick
UNRAVEILING BIT-TORRENT
The Corners of Lisbon - Bespoke Tours
Cluster based routing protocol 1
Cluster based routing protocol
Presentación1animking
Presentación4
El calentamiento global
A crise na educação
Elamor yamistad cccc
Ad

Similar to Mongo db modifiers (20)

PDF
Creating, Updating and Deleting Document in MongoDB
PPTX
MongoDB (Advanced)
PPTX
MongoDB's index and query optimize
PPTX
Indexing and Query Optimizer (Aaron Staple)
PDF
Getting Started with MongoDB: 4 Application Designs
PDF
MongoD Essentials
PPTX
Mongo Nosql CRUD Operations
PPTX
Mongo db index
PPTX
MongoDB - Indexing- Types iNDEXING.pptx
PPTX
Internal Anatomy of an Update
PPT
Mongo db tutorials
PPTX
Concurrency Patterns with MongoDB
PPS
MongoDB crud
PDF
MongoDB Webtech conference 2010
PPTX
PDF
Mongo db문서의생성,갱신,삭제
PPTX
MongoDB-SESSION03
PDF
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
ODP
MongoDB - Javascript for your Data
ODP
MongoDB - javascript for your data
Creating, Updating and Deleting Document in MongoDB
MongoDB (Advanced)
MongoDB's index and query optimize
Indexing and Query Optimizer (Aaron Staple)
Getting Started with MongoDB: 4 Application Designs
MongoD Essentials
Mongo Nosql CRUD Operations
Mongo db index
MongoDB - Indexing- Types iNDEXING.pptx
Internal Anatomy of an Update
Mongo db tutorials
Concurrency Patterns with MongoDB
MongoDB crud
MongoDB Webtech conference 2010
Mongo db문서의생성,갱신,삭제
MongoDB-SESSION03
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
MongoDB - Javascript for your Data
MongoDB - javascript for your data

Recently uploaded (20)

PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Approach and Philosophy of On baking technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Machine learning based COVID-19 study performance prediction
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPT
Teaching material agriculture food technology
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
DOCX
The AUB Centre for AI in Media Proposal.docx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Approach and Philosophy of On baking technology
Understanding_Digital_Forensics_Presentation.pptx
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
Machine learning based COVID-19 study performance prediction
Dropbox Q2 2025 Financial Results & Investor Presentation
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Programs and apps: productivity, graphics, security and other tools
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Teaching material agriculture food technology
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectral efficient network and resource selection model in 5G networks
The AUB Centre for AI in Media Proposal.docx

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