SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Intro to NoSQL databases

Redis & Mongo DB
Overview
➲
●

Redis
What, when, why, how

➲Mongo
●

➲

DB

What, when, why, how

Questions
Redis
➲
●
●
●

What is Redis
Redis is an open-source key-value data store
Primarily an in-memory database
Has the option of persisting data indefinitely

➲Key
●

Data Structures

Strings, lists, sets, hashes, sorted sets
Why Redis
➲Speed
●

– Redis is really fast

Hard to find specific numbers but I've seen claims
that it's up to 5-20 times faster than traditional
databases for certain applications

➲Specialized

– Has highly customized tools
that solves certain problems extremely
well.
➲This contrasts with a traditional RDBMS that
tries to be all things to all people
➲Generally seen as complimentary to a
traditional RDBMS
When To Use Redis
➲You

have to know the best type of data
structure and algorithm for solving the
problem you have
➲Redis publishes the Big-O notation
performance numbers for all it's operations
➲If redis supports that algorithm then you'll
probably want to use redis for it
Big O Review
➲O(1)
●
●

– constant time.

Fastest any algorithm can be
Always takes the same amount of time

➲O(log(n))
●
●

– logarithmic time

2nd fastest time
Uses a divide and conquer

➲O(n) – linear time
➲Others include
●

O(n^2), O(c^n), O(n+m*log(m))
Using Redis
➲set x:y "{id:9000, email: 'test@axum.net'}"
➲get x:y
➲“set” - command
➲x:y – key
➲"{id:9000, email: 'test@axum.net'}" - value
➲By convention keys are of the form:
●

z:y:x

➲But

other values are allowed
Using Redis
➲A

simple application is to use redis to count
page views

●
●

incr stats:page:about
incrby ratings:video:1233 6
Mongo DB
➲MongoDB

has the same concept of a database that you are
familiar with
➲Within a MongoDB instance you can have zero or more
databases, each acting as high-level containers for
everything else.
➲A database can have zero or more collections. A collection
shares enough in common with a traditional table that you
can safely think of the two as the same thing.
➲Collections are made up of zero or more documents. Again,
a document can safely be thought of as a row.
➲
Mongo DB
➲A

document is made up of one or more fields, which you can
probably guess are a lot like columns.
➲Indexes in MongoDB function much like their RDBMS
counterparts.
➲Cursors - when you ask MongoDB for data, it returns a
cursor, which we can do things to, such as counting or
skipping ahead, without actually pulling down data.
Mongo DB
➲If

●

●
●
●

Mongo is so similar to existing DBMS then why
use new terminology (collection vs. table,
document vs. row and field vs. column)?

relational databases define columns at the table level whereas a
document-oriented database defines its fields at the
document level.
Each document within a collection can have its own unique set of
fields.
A collection imposes less strict rules on a container in
comparison to a table
A document usually has a lot more information than a row.
Using Mongo
➲
●
●

➲
●
●

The mongo CLI uses JavaScript syntax
db.help() prints the list of available commands
db.stats() prints the current information about your db

Since Collections do not have schemas we can do
the following:

db.unicorns.insert({name: ’Aurora’, gender: ’f’, weight: 450})
The 'unicorns collection will be created and document with name='Aurora' will be added to
it
Using Mongo
➲
●
●
●

Other Commands
db.unicorns.find() - returns list of documents in the 'unicorns' collection
"_id" : ObjectId("5239aaa9635c8909872a74fa"), "name" : "Aurora", "gender" :
"f", "weight" : 450 }
db.unicorns.find({gender: ’m’, weight: {$gt: 700}})

➲db.stats()
●

➲

prints the current information about your db

db.unicorns.update({name: ’Roodles’}, {weight: 590})
Demo
➲
Questions
➲

Más contenido relacionado

La actualidad más candente

21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...Athens Big Data
 
Updating materialized views and caches using kafka
Updating materialized views and caches using kafkaUpdating materialized views and caches using kafka
Updating materialized views and caches using kafkaZach Cox
 
Introduction to mongo db by zain
Introduction to mongo db by zainIntroduction to mongo db by zain
Introduction to mongo db by zainKenAndTea
 
«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»Olga Lavrentieva
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB Habilelabs
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBLee Theobald
 
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014Gerd König
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDBCésar Trigo
 
Replicating application data into materialized views
Replicating application data into materialized viewsReplicating application data into materialized views
Replicating application data into materialized viewsZach Cox
 
Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Developmentmssaman
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introductionEdward Yoon
 

La actualidad más candente (20)

Mongo db1
Mongo db1Mongo db1
Mongo db1
 
MongoDB
MongoDBMongoDB
MongoDB
 
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
21st Athens Big Data Meetup - 1st Talk - Fast and simple data exploration wit...
 
Mongodb @ vrt
Mongodb @ vrtMongodb @ vrt
Mongodb @ vrt
 
Updating materialized views and caches using kafka
Updating materialized views and caches using kafkaUpdating materialized views and caches using kafka
Updating materialized views and caches using kafka
 
Introduction to mongo db by zain
Introduction to mongo db by zainIntroduction to mongo db by zain
Introduction to mongo db by zain
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»«NoSQL Databases and Polyglot Persistence»
«NoSQL Databases and Polyglot Persistence»
 
Mongo db
Mongo dbMongo db
Mongo db
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
Basics of MongoDB
Basics of MongoDB Basics of MongoDB
Basics of MongoDB
 
NoSQL
NoSQLNoSQL
NoSQL
 
Introduction to mongodb
Introduction to mongodbIntroduction to mongodb
Introduction to mongodb
 
An Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDBAn Introduction To NoSQL & MongoDB
An Introduction To NoSQL & MongoDB
 
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
shark attack on sql-on-hadoop Talk at BerlinBuzzwords 2014
 
An introduction to MongoDB
An introduction to MongoDBAn introduction to MongoDB
An introduction to MongoDB
 
Mongo db
Mongo dbMongo db
Mongo db
 
Replicating application data into materialized views
Replicating application data into materialized viewsReplicating application data into materialized views
Replicating application data into materialized views
 
Mango Database - Web Development
Mango Database - Web DevelopmentMango Database - Web Development
Mango Database - Web Development
 
MongoDB introduction
MongoDB introductionMongoDB introduction
MongoDB introduction
 

Similar a Redis IU (20)

Top MongoDB interview Questions and Answers
Top MongoDB interview Questions and AnswersTop MongoDB interview Questions and Answers
Top MongoDB interview Questions and Answers
 
Everything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptxEverything You Need to Know About MongoDB Development.pptx
Everything You Need to Know About MongoDB Development.pptx
 
Mongo db dhruba
Mongo db dhrubaMongo db dhruba
Mongo db dhruba
 
Mongodb
MongodbMongodb
Mongodb
 
Mongo db
Mongo dbMongo db
Mongo db
 
mongodb11 (1) (1).pptx
mongodb11 (1) (1).pptxmongodb11 (1) (1).pptx
mongodb11 (1) (1).pptx
 
Mongo db
Mongo dbMongo db
Mongo db
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
 
NoSQL and MongoDB
NoSQL and MongoDBNoSQL and MongoDB
NoSQL and MongoDB
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 
Mongodb
MongodbMongodb
Mongodb
 
MongoDB.pptx
MongoDB.pptxMongoDB.pptx
MongoDB.pptx
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
 
The Little MongoDB Book - Karl Seguin
The Little MongoDB Book - Karl SeguinThe Little MongoDB Book - Karl Seguin
The Little MongoDB Book - Karl Seguin
 
MongoDB
MongoDBMongoDB
MongoDB
 
NoSQL Databases
NoSQL DatabasesNoSQL Databases
NoSQL Databases
 
Mongodb Introduction
Mongodb IntroductionMongodb Introduction
Mongodb Introduction
 
Mongodb
MongodbMongodb
Mongodb
 
Kalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB TutorialsKalp Corporate MongoDB Tutorials
Kalp Corporate MongoDB Tutorials
 

Más de Isaiah Edem

Sleep and Dreams
Sleep and DreamsSleep and Dreams
Sleep and DreamsIsaiah Edem
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceIsaiah Edem
 
Outdated Technology
Outdated TechnologyOutdated Technology
Outdated TechnologyIsaiah Edem
 
Computer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesComputer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesIsaiah Edem
 
Importanc of softwaretesting
Importanc of softwaretestingImportanc of softwaretesting
Importanc of softwaretestingIsaiah Edem
 
Cyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionCyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionIsaiah Edem
 

Más de Isaiah Edem (8)

Sleep and Dreams
Sleep and DreamsSleep and Dreams
Sleep and Dreams
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
Outdated Technology
Outdated TechnologyOutdated Technology
Outdated Technology
 
Green Computing
Green ComputingGreen Computing
Green Computing
 
Computer Forensics in Fighting Crimes
Computer Forensics in Fighting CrimesComputer Forensics in Fighting Crimes
Computer Forensics in Fighting Crimes
 
Importanc of softwaretesting
Importanc of softwaretestingImportanc of softwaretesting
Importanc of softwaretesting
 
Cyber Security & User's Privacy Invasion
Cyber Security & User's Privacy InvasionCyber Security & User's Privacy Invasion
Cyber Security & User's Privacy Invasion
 
Fear
FearFear
Fear
 

Último

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 

Último (20)

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 

Redis IU

  • 1. Intro to NoSQL databases Redis & Mongo DB
  • 2. Overview ➲ ● Redis What, when, why, how ➲Mongo ● ➲ DB What, when, why, how Questions
  • 3. Redis ➲ ● ● ● What is Redis Redis is an open-source key-value data store Primarily an in-memory database Has the option of persisting data indefinitely ➲Key ● Data Structures Strings, lists, sets, hashes, sorted sets
  • 4. Why Redis ➲Speed ● – Redis is really fast Hard to find specific numbers but I've seen claims that it's up to 5-20 times faster than traditional databases for certain applications ➲Specialized – Has highly customized tools that solves certain problems extremely well. ➲This contrasts with a traditional RDBMS that tries to be all things to all people ➲Generally seen as complimentary to a traditional RDBMS
  • 5. When To Use Redis ➲You have to know the best type of data structure and algorithm for solving the problem you have ➲Redis publishes the Big-O notation performance numbers for all it's operations ➲If redis supports that algorithm then you'll probably want to use redis for it
  • 6. Big O Review ➲O(1) ● ● – constant time. Fastest any algorithm can be Always takes the same amount of time ➲O(log(n)) ● ● – logarithmic time 2nd fastest time Uses a divide and conquer ➲O(n) – linear time ➲Others include ● O(n^2), O(c^n), O(n+m*log(m))
  • 7. Using Redis ➲set x:y "{id:9000, email: 'test@axum.net'}" ➲get x:y ➲“set” - command ➲x:y – key ➲"{id:9000, email: 'test@axum.net'}" - value ➲By convention keys are of the form: ● z:y:x ➲But other values are allowed
  • 8. Using Redis ➲A simple application is to use redis to count page views ● ● incr stats:page:about incrby ratings:video:1233 6
  • 9. Mongo DB ➲MongoDB has the same concept of a database that you are familiar with ➲Within a MongoDB instance you can have zero or more databases, each acting as high-level containers for everything else. ➲A database can have zero or more collections. A collection shares enough in common with a traditional table that you can safely think of the two as the same thing. ➲Collections are made up of zero or more documents. Again, a document can safely be thought of as a row. ➲
  • 10. Mongo DB ➲A document is made up of one or more fields, which you can probably guess are a lot like columns. ➲Indexes in MongoDB function much like their RDBMS counterparts. ➲Cursors - when you ask MongoDB for data, it returns a cursor, which we can do things to, such as counting or skipping ahead, without actually pulling down data.
  • 11. Mongo DB ➲If ● ● ● ● Mongo is so similar to existing DBMS then why use new terminology (collection vs. table, document vs. row and field vs. column)? relational databases define columns at the table level whereas a document-oriented database defines its fields at the document level. Each document within a collection can have its own unique set of fields. A collection imposes less strict rules on a container in comparison to a table A document usually has a lot more information than a row.
  • 12. Using Mongo ➲ ● ● ➲ ● ● The mongo CLI uses JavaScript syntax db.help() prints the list of available commands db.stats() prints the current information about your db Since Collections do not have schemas we can do the following: db.unicorns.insert({name: ’Aurora’, gender: ’f’, weight: 450}) The 'unicorns collection will be created and document with name='Aurora' will be added to it
  • 13. Using Mongo ➲ ● ● ● Other Commands db.unicorns.find() - returns list of documents in the 'unicorns' collection "_id" : ObjectId("5239aaa9635c8909872a74fa"), "name" : "Aurora", "gender" : "f", "weight" : 450 } db.unicorns.find({gender: ’m’, weight: {$gt: 700}}) ➲db.stats() ● ➲ prints the current information about your db db.unicorns.update({name: ’Roodles’}, {weight: 590})

Notas del editor

  1. {}