Submit Search
Upload
Quick reference for mongo shell commands
•
Download as TXT, PDF
•
0 likes
•
303 views
Rajkumar Asohan, PMP
Follow
Cheat Sheet for MongoDB
Read less
Read more
Education
Report
Share
Report
Share
1 of 4
Download now
Recommended
Quick reference for solr
Quick reference for solr
Rajkumar Asohan, PMP
Quick reference for spark sql
Quick reference for spark sql
Rajkumar Asohan, PMP
Quick reference for zookeeper commands
Quick reference for zookeeper commands
Rajkumar Asohan, PMP
Db health check
Db health check
Akash Pramanik
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
Mark Wong
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
PgDay.Seoul
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
Recommended
Quick reference for solr
Quick reference for solr
Rajkumar Asohan, PMP
Quick reference for spark sql
Quick reference for spark sql
Rajkumar Asohan, PMP
Quick reference for zookeeper commands
Quick reference for zookeeper commands
Rajkumar Asohan, PMP
Db health check
Db health check
Akash Pramanik
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
PostgreSQL Portland Performance Practice Project - Database Test 2 Tuning
Mark Wong
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
PgDay.Seoul
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PGConf APAC
12c SQL Plan Directives
12c SQL Plan Directives
Franck Pachot
Quick reference for curl
Quick reference for curl
Rajkumar Asohan, PMP
Redo logfile addition in oracle rac 12c
Redo logfile addition in oracle rac 12c
Debasish Nayak
SQLQueries
SQLQueries
karunakar81987
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
The Essential postgresql.conf
The Essential postgresql.conf
Robert Treat
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
I Goo Lee
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
Backup and-recovery2
Backup and-recovery2
Command Prompt., Inc
Sas online training
Sas online training
TRAINING ICON
Free toolsinstall
Free toolsinstall
Hemant Nagar
Backups
Backups
Svet Ivantchev
[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features
hyeongchae lee
Restore MySQL database from mysqlbackup
Restore MySQL database from mysqlbackup
AllDatabaseSolutions
Db2 imp commands
Db2 imp commands
muhammad adeel
Hadoop Performance comparison
Hadoop Performance comparison
arunkumar sadhasivam
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
PostgresOpen
Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop
iACT Global
Poster images
Poster images
DIDI1998sdf
SALMAN UPDATED CV NEW
SALMAN UPDATED CV NEW
SALMAN KHAN
Scarab4 slideshare
Scarab4 slideshare
Katherine Rowell
More Related Content
What's hot
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PGConf APAC
12c SQL Plan Directives
12c SQL Plan Directives
Franck Pachot
Quick reference for curl
Quick reference for curl
Rajkumar Asohan, PMP
Redo logfile addition in oracle rac 12c
Redo logfile addition in oracle rac 12c
Debasish Nayak
SQLQueries
SQLQueries
karunakar81987
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Mark Wong
The Essential postgresql.conf
The Essential postgresql.conf
Robert Treat
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
I Goo Lee
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Alexey Lesovsky
Backup and-recovery2
Backup and-recovery2
Command Prompt., Inc
Sas online training
Sas online training
TRAINING ICON
Free toolsinstall
Free toolsinstall
Hemant Nagar
Backups
Backups
Svet Ivantchev
[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features
hyeongchae lee
Restore MySQL database from mysqlbackup
Restore MySQL database from mysqlbackup
AllDatabaseSolutions
Db2 imp commands
Db2 imp commands
muhammad adeel
Hadoop Performance comparison
Hadoop Performance comparison
arunkumar sadhasivam
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
PostgresOpen
What's hot
(18)
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
PGConf APAC 2018 - Lightening Talk #2 - Centralizing Authorization in PostgreSQL
12c SQL Plan Directives
12c SQL Plan Directives
Quick reference for curl
Quick reference for curl
Redo logfile addition in oracle rac 12c
Redo logfile addition in oracle rac 12c
SQLQueries
SQLQueries
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
The Essential postgresql.conf
The Essential postgresql.conf
Optimizer Cost Model MySQL 5.7
Optimizer Cost Model MySQL 5.7
Deep dive into PostgreSQL statistics.
Deep dive into PostgreSQL statistics.
Backup and-recovery2
Backup and-recovery2
Sas online training
Sas online training
Free toolsinstall
Free toolsinstall
Backups
Backups
[PGDay.Seoul 2020] PostgreSQL 13 New Features
[PGDay.Seoul 2020] PostgreSQL 13 New Features
Restore MySQL database from mysqlbackup
Restore MySQL database from mysqlbackup
Db2 imp commands
Db2 imp commands
Hadoop Performance comparison
Hadoop Performance comparison
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Kevin Kempter PostgreSQL Backup and Recovery Methods @ Postgres Open
Viewers also liked
Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop
iACT Global
Poster images
Poster images
DIDI1998sdf
SALMAN UPDATED CV NEW
SALMAN UPDATED CV NEW
SALMAN KHAN
Scarab4 slideshare
Scarab4 slideshare
Katherine Rowell
Fms solutii externalizare mng ro
Fms solutii externalizare mng ro
Razvan CALOTA
06. Усходнеславянскія плямёны на тэрыторыі Беларусі. На шляху да дзяржавы
06. Усходнеславянскія плямёны на тэрыторыі Беларусі. На шляху да дзяржавы
AnastasiyaF
book Desert storm has it ended christ in islam ahmed dedat pdf
book Desert storm has it ended christ in islam ahmed dedat pdf
slideshare account
El Vareliano
El Vareliano
Juan Pablo Franzetti Abal
DBHS55-PSR-P_LR
DBHS55-PSR-P_LR
Joseph Vipin Rajan
Stock Repurchases aka Share Buybacks for US Firms
Stock Repurchases aka Share Buybacks for US Firms
Pranav Ghai
A Profit Maximization Scheme with Guaranteed Quality of Service in Cloud Com...
A Profit Maximization Scheme with Guaranteed Quality of Service in Cloud Com...
nexgentechnology
Thiqar kploat 27 10 2016
Thiqar kploat 27 10 2016
Nour Elbader
01. Становішча ў Беларусі напярэдадні Кастрычніцкай рэвалюцыі
01. Становішча ў Беларусі напярэдадні Кастрычніцкай рэвалюцыі
AnastasiyaF
23. Хрысціянства на заходніх землях Старажытнай Русі
23. Хрысціянства на заходніх землях Старажытнай Русі
AnastasiyaF
Viewers also liked
(14)
Introduction to Big Data & Hadoop
Introduction to Big Data & Hadoop
Poster images
Poster images
SALMAN UPDATED CV NEW
SALMAN UPDATED CV NEW
Scarab4 slideshare
Scarab4 slideshare
Fms solutii externalizare mng ro
Fms solutii externalizare mng ro
06. Усходнеславянскія плямёны на тэрыторыі Беларусі. На шляху да дзяржавы
06. Усходнеславянскія плямёны на тэрыторыі Беларусі. На шляху да дзяржавы
book Desert storm has it ended christ in islam ahmed dedat pdf
book Desert storm has it ended christ in islam ahmed dedat pdf
El Vareliano
El Vareliano
DBHS55-PSR-P_LR
DBHS55-PSR-P_LR
Stock Repurchases aka Share Buybacks for US Firms
Stock Repurchases aka Share Buybacks for US Firms
A Profit Maximization Scheme with Guaranteed Quality of Service in Cloud Com...
A Profit Maximization Scheme with Guaranteed Quality of Service in Cloud Com...
Thiqar kploat 27 10 2016
Thiqar kploat 27 10 2016
01. Становішча ў Беларусі напярэдадні Кастрычніцкай рэвалюцыі
01. Становішча ў Беларусі напярэдадні Кастрычніцкай рэвалюцыі
23. Хрысціянства на заходніх землях Старажытнай Русі
23. Хрысціянства на заходніх землях Старажытнай Русі
Similar to Quick reference for mongo shell commands
Pluggable database tutorial
Pluggable database tutorial
Osama Mustafa
Hadoop on aws amazon
Hadoop on aws amazon
Sandish Kumar H N
Hadoop on aws amazon
Hadoop on aws amazon
Sandish Kumar H N
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
Michael Schwern
database-querry-student-note
database-querry-student-note
Leerpiny Makouach
Pluggable database tutorial 2
Pluggable database tutorial 2
Osama Mustafa
Mongodb workshop
Mongodb workshop
Harun Yardımcı
Oracle data guard configuration in 12c
Oracle data guard configuration in 12c
uzzal basak
PHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHP
Vibrant Technologies & Computers
Drupal II: The SQL
Drupal II: The SQL
ddiers
Database decommission process
Database decommission process
K Kumar Guduru
PHP Data Objects
PHP Data Objects
Wez Furlong
About Data::ObjectDriver
About Data::ObjectDriver
Yoshiki Kurihara
Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free Migration
Andrew Hutchings
Quick reference for Grafana
Quick reference for Grafana
Rajkumar Asohan, PMP
Service discovery and configuration provisioning
Service discovery and configuration provisioning
Source Ministry
Percona toolkit
Percona toolkit
Karwin Software Solutions LLC
Sqlite perl
Sqlite perl
Ashoka Vanjare
Working with databases in Perl
Working with databases in Perl
Laurent Dami
Csql Cache Presentation
Csql Cache Presentation
Bijaya Kumar Sahu
Similar to Quick reference for mongo shell commands
(20)
Pluggable database tutorial
Pluggable database tutorial
Hadoop on aws amazon
Hadoop on aws amazon
Hadoop on aws amazon
Hadoop on aws amazon
Simple Ways To Be A Better Programmer (OSCON 2007)
Simple Ways To Be A Better Programmer (OSCON 2007)
database-querry-student-note
database-querry-student-note
Pluggable database tutorial 2
Pluggable database tutorial 2
Mongodb workshop
Mongodb workshop
Oracle data guard configuration in 12c
Oracle data guard configuration in 12c
PHP - Intriduction to MySQL And PHP
PHP - Intriduction to MySQL And PHP
Drupal II: The SQL
Drupal II: The SQL
Database decommission process
Database decommission process
PHP Data Objects
PHP Data Objects
About Data::ObjectDriver
About Data::ObjectDriver
Drizzle to MySQL, Stress Free Migration
Drizzle to MySQL, Stress Free Migration
Quick reference for Grafana
Quick reference for Grafana
Service discovery and configuration provisioning
Service discovery and configuration provisioning
Percona toolkit
Percona toolkit
Sqlite perl
Sqlite perl
Working with databases in Perl
Working with databases in Perl
Csql Cache Presentation
Csql Cache Presentation
Recently uploaded
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
MaritesTamaniVerdade
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
PoojaSen20
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
Mebane Rash
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
Ramakrishna Reddy Bijjam
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
MJDuyan
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
Jisc
Spatium Project Simulation student brief
Spatium Project Simulation student brief
Association for Project Management
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
pradhanghanshyam7136
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
Association for Project Management
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
VishalSingh1417
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Denish Jangid
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
MaryamAhmad92
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
VishalSingh1417
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
VishalSingh1417
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Maksud Ahmed
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
Celine George
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
Recently uploaded
(20)
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
Spatium Project Simulation student brief
Spatium Project Simulation student brief
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
Quick reference for mongo shell commands
1.
Create Database =============== Syntax use DATABASE_NAME Ex use
mydb Verification show dbs -------------------------------------------------------------------------------- ----------------------------------------------------- Drop Database ============= Syntax: db.dropDatabase() Ex: use mydb db.dropDatabase() Verification: show dbs -------------------------------------------------------------------------------- ----------------------------------------------------- Create/Insert Collection ======================== Syntax: db.createCollection(name, options) Ex: use test db.createCollection("mycollection") db.createCollection("mycol", { capped : true, autoIndexID : true, size : 6142800, max : 10000 } ) db.tutorialspoint.insert({"name" : "tutorialspoint"}) Verification: show collections -------------------------------------------------------------------------------- ----------------------------------------------------- Drop Collection =============== Syntax: db.COLLECTION_NAME.drop() Verification: use mydb show collections Ex: db.mycollection.drop() Verification: show collections -------------------------------------------------------------------------------- ----------------------------------------------------- Insert Document =============== Syntax: db.COLLECTION_NAME.insert(document) Ex: db.mycol.insert({ _id: ObjectId(7df78ad8902c), title: 'MongoDB Overview', description: 'MongoDB is no sql database', by: 'tutorials point', url: 'http://www.tutorialspoint.com', tags: ['mongodb', 'database', 'NoSQL'], likes: 100 }) db.post.insert([
2.
{ title: 'MongoDB Overview', description:
'MongoDB is no sql database', by: 'tutorials point', url: 'http://www.tutorialspoint.com', tags: ['mongodb', 'database', 'NoSQL'], likes: 100 }, { title: 'NoSQL Database', description: 'NoSQL database doesn't have tables', by: 'tutorials point', url: 'http://www.tutorialspoint.com', tags: ['mongodb', 'database', 'NoSQL'], likes: 20, comments: [ { user:'user1', message: 'My first comment', dateCreated: new Date(2013,11,10,2,35), like: 0 } ] } ]) Verification: -------------------------------------------------------------------------------- ----------------------------------------------------- Query Document ============== Syntax: db.COLLECTION_NAME.find() db.COLLECTION_NAME.find().pretty() db.COLLECTION_NAME.find({key1:value1, key2:value2}).pretty() db.COLLECTION_NAME.find( { $or: [ {key1: value1}, {key2:value2} ] } ).pretty() Ex: db.mycol.find().pretty() db.mycol.find({"by":"tutorials point","title": "MongoDB Overview"}).pretty() db.mycol.find({$or:[{"by":"tutorials point"},{"title": "MongoDB Overview"}]}).pretty() db.mycol.find({"likes": {$gt:10}, $or: [{"by": "tutorials point"},{"title": "MongoDB Overview"}]}).pretty() -------------------------------------------------------------------------------- ----------------------------------------------------- Update values in Document ========================= Syntax: db.COLLECTION_NAME.update(SELECTIOIN_CRITERIA, UPDATED_DATA) Ex: db.mycol.update({'title':'MongoDB Overview'},{$set:{'title':'New MongoDB Tutorial'}}) Verification: db.mycol.find() -------------------------------------------------------------------------------- ----------------------------------------------------- Replace Document ================ Syntax:
3.
db.COLLECTION_NAME.save({_id:ObjectId(),NEW_DATA}) Ex: db.mycol.save( { "_id" : ObjectId(5983548781331adf45ec7),
"title":"Tutorials Point New Topic", "by":"Tutorials Point" } ) Verification: db.mycol.find() -------------------------------------------------------------------------------- ----------------------------------------------------- Delete Document =============== Syntax: db.COLLECTION_NAME.remove(DELLETION_CRITTERIA) db.COLLECTION_NAME.remove() Ex: db.mycol.remove({'title':'MongoDB Overview'}) db.mycol.remove() Verification: db.mycol.find() -------------------------------------------------------------------------------- ----------------------------------------------------- Projection ========== Syntax: db.COLLECTION_NAME.find({},{KEY:1}) Ex: db.mycol.find({},{"title":1,_id:0}) -------------------------------------------------------------------------------- ----------------------------------------------------- Limit Records ============= Syntax: db.COLLECTION_NAME.find().limit(NUMBER) db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER) Ex: db.mycol.find({},{"title":1,_id:0}).limit(2) db.mycol.find({},{"title":1,_id:0}).limit(1).skip(1) -------------------------------------------------------------------------------- ----------------------------------------------------- Sort Records ============ Syntax: db.COLLECTION_NAME.find().sort({KEY:1}) Ex: db.mycol.find({},{"title":1,_id:0}).sort({"title":-1}) -------------------------------------------------------------------------------- ----------------------------------------------------- Indexing ======== Syntax: db.COLLECTION_NAME.ensureIndex({KEY:1}) Ex: db.mycol.ensureIndex({"title":1}) db.mycol.ensureIndex({"title":1,"description":-1}) -------------------------------------------------------------------------------- ----------------------------------------------------- Aggregation =========== Syntax: db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION) Ex:
4.
db.mycol.aggregate([{$group : {_id
: "$by_user", num_tutorial : {$sum : 1}}}]) -------------------------------------------------------------------------------- ----------------------------------------------------- Create Backup/Restore ===================== Syntax: mongodump mongorestore
Download now