Movatterモバイル変換


[0]ホーム

URL:


Georges Abboudeh, profile picture
Uploaded byGeorges Abboudeh
PPTX, PDF23 views

No SQL DB lecture showing structure and syntax

NO sql database using MongoDBthrough examples and queries

Embed presentation

Download to read offline
What is NoSQL?1NoSQL = "Not Only SQL“Designed for:Big DataReal-time web appsFlexible data modelsEmphasizes scalability, performance, andflexibility
2Why NoSQL?Limitations of traditional SQL:Fixed schemasPoor horizontal scalingAdvantages of NoSQL:Schema-less modelsHigh performanceEasy replication and partitioning
Types of NoSQL• Key-value• Graph database• Document-oriented• Column family3
Use Cases for NoSQL Social networks IoT applications Real-time analytics Product catalogs Content Management Systems (CMS)
How does NoSQL vary from RDBMS?10SQL NoSQLRelational Database Management System (RDBMS) Non-relational or distributed database system.These databases have fixed or static or predefined schema They have dynamic schemaThese databases are best suited for complex queries These databases are not so good for complex queriesVertically Scalable Horizontally scalableFollows ACID property Follows BASE property NoSQL (often interpreted as Not only SQL) database It provides a mechanism for storage and retrieval of data that is modeledin means other than the tabular relations used in relational databases.
16
Introduction to MongoDB7 Document-oriented NoSQL DB Stores data in BSON (Binary JSON) Created by MongoDB Inc. Open-source with enterprise editions
MongoDB Key Features Dynamic schema (schema-less) Horizontal scalability via sharding Built-in replication Powerful query language Integration with popular languages (Python, Node.js, Java,etc.)
RDB Concepts to NO SQL22RDBMS MongoDBDatabase DatabaseTable, View CollectionRow Document (BSON)Column FieldIndex IndexJoin Embedded DocumentForeign Key ReferencePartition ShardCollection is notstrict about whatit StoresSchema-lessHierarchy isevident in thedesignEmbeddedDocument?
10Download and installhttps://www.mongodb.com/try/download/communityMongoDB ServerMongoDB Shellhttps://www.mongodb.com/try/download/shell
11Create Database After connecting to your database using mongosh, you can see whichdatabase you are using by typing db in your terminal. Show all databases To see all available databases, in your terminal type show dbs Change or Create a Database You can change or create a new database by typing use then the name of thedatabase.
12Create Collection Method 1 You can create a collection using the createCollection() database method. Method 2 You can also create a collection during the insert process.
13Insert Documents There are 2 methods to insert documents into a MongoDB database. insertOne(): To insert a single document, use the insertOne() method. insertMany(): To insert multiple documents at once, use the insertMany()method.
14Find Find Data: There are 2 methods to find and select data from a MongoDBcollection, find() and findOne(). To select data from a collection in MongoDB, we can use the find() method. This method accepts a query object. If left empty, all documents will be returned. To select only one document, we can use the findOne() method. This method accepts a query object. If left empty, it will return the first documentit finds.
15Querying Data
16Projection Both find methods accept a second parameter called projection. This parameteris an object that describes which fields to include in the results.
17Projection We use a 1 to include a field and 0 to exclude a field. Notice that the _id field is also included. This field is always included unlessspecifically excluded.
18Projection Let's exclude the date category field. All other fields will be included in the results. We will get an error if we try to specify both 0 and 1 in the same object.
19Update Document To update an existing document we can use the updateOne() or updateMany()methods. The first parameter is a query object to define which document or documentsshould be updated. The second parameter is an object defining the updated data. The updateOne() method will update the first document that is found matchingthe provided query.
20Update DocumentInsert if not found: If you would like to insert the document if it is not found,you can use the upsert option.
21Update Document updateMany(): The updateMany() method will update all documents that matchthe provided query.
22Delete Documents deleteOne(): The deleteOne() method will delete the first document that matchesthe query provided. deleteMany(): The deleteMany() method will delete all documents that match thequery provided.
23MongoDB Query OperatorsName Description$eq Matches value that are equal to a specified value$gt, $gte Matches values that are greater than (or equal to a specifiedvalue$lt, $lte Matches values less than or ( equal to ) a specified value$ne Matches values that are not equal to a specified value$in Matches any of the values specified in an array$nin Matches none of the values specified in an array$or Joins query clauses with a logical OR returns all$and Join query clauses with a loginal AND$not Inverts the effect of a query expression$nor Join query clauses with a logical NOR$exists Matches documents that have a specified field$regex Allows the use of regular expressions when evaluating field values$text Performs a text search$where Uses a JavaScript expression to match documents
24MongoDB Query OperatorsExamples:
25Update Operators Fields: The following operators can be used to update fields: $currentDate: Sets the field value to the current date $inc: Increments the field value $rename: Renames the field $set: Sets the value of a field $unset: Removes the field from the document Array: The following operators assist with updating arrays. $addToSet: Adds distinct elements to an array $pop: Removes the first or last element of an array $pull: Removes all elements from an array that match the query $push: Adds an element to an array
26ExampleSet the lastUpdated field to the current date:
27ExampleIncrement likes by 1:Rename body to content:Set a new field status to "published":Remove the category field:
28ExampleAdd a tag only if it’s not already present:Remove last element of the tags array:Remove first element:Remove "news" from the tags array:Add "announcement" to the tags array:

Recommended

PPTX
Introduction to MongoDB – A NoSQL Database
PPTX
Mongo db
PDF
full stack modul 5, mongodb,webpack,front-end,back-end
PPTX
Getting Started with MongoDB
PPTX
Mongo Nosql CRUD Operations
PPTX
Introduction to MongoDB
PPTX
mongodb introduction11111111111111111111
PPTX
Introduction To MongoDB
PPTX
MongoDB installation,CRUD operation & JavaScript shell
PPTX
MongoDB - An Introduction
PDF
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
PDF
Mongo db basics
PPTX
MONGODB koko ko kok k ok kk ok okoko.pptx
PPT
Mongo db basics
PPT
9. Document Oriented Databases
PPS
MongoDB crud
PPTX
Mongo db queries
PPT
MongoDB
PPTX
UNIT-1 MongoDB.pptx
PPTX
MongoDB_ppt.pptx
PPTX
lecture_34e.pptx
PPTX
MongoDB using Grails plugin by puneet behl
PPTX
Mongo db basic installation
PDF
MongoDB for Coder Training (Coding Serbia 2013)
PPTX
mongo.pptx
PPTX
MongoDbPpt based on python installation.
PDF
An introduction to MongoDB
PDF
Getting Started with MongoDB (TCF ITPC 2014)
PPTX
FF0316-01-johari-window-model-for-powerpoint-16x9-1.pptx
PPTX
Johari Window Coaching Slides and personality assessment

More Related Content

PPTX
Introduction to MongoDB – A NoSQL Database
PPTX
Mongo db
PDF
full stack modul 5, mongodb,webpack,front-end,back-end
PPTX
Getting Started with MongoDB
PPTX
Mongo Nosql CRUD Operations
PPTX
Introduction to MongoDB
PPTX
mongodb introduction11111111111111111111
PPTX
Introduction To MongoDB
Introduction to MongoDB – A NoSQL Database
Mongo db
full stack modul 5, mongodb,webpack,front-end,back-end
Getting Started with MongoDB
Mongo Nosql CRUD Operations
Introduction to MongoDB
mongodb introduction11111111111111111111
Introduction To MongoDB

Similar to No SQL DB lecture showing structure and syntax

PPTX
MongoDB installation,CRUD operation & JavaScript shell
PPTX
MongoDB - An Introduction
PDF
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
PDF
Mongo db basics
PPTX
MONGODB koko ko kok k ok kk ok okoko.pptx
PPT
Mongo db basics
PPT
9. Document Oriented Databases
PPS
MongoDB crud
PPTX
Mongo db queries
PPT
MongoDB
PPTX
UNIT-1 MongoDB.pptx
PPTX
MongoDB_ppt.pptx
PPTX
lecture_34e.pptx
PPTX
MongoDB using Grails plugin by puneet behl
PPTX
Mongo db basic installation
PDF
MongoDB for Coder Training (Coding Serbia 2013)
PPTX
mongo.pptx
PPTX
MongoDbPpt based on python installation.
PDF
An introduction to MongoDB
PDF
Getting Started with MongoDB (TCF ITPC 2014)
MongoDB installation,CRUD operation & JavaScript shell
MongoDB - An Introduction
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
Mongo db basics
MONGODB koko ko kok k ok kk ok okoko.pptx
Mongo db basics
9. Document Oriented Databases
MongoDB crud
Mongo db queries
MongoDB
UNIT-1 MongoDB.pptx
MongoDB_ppt.pptx
lecture_34e.pptx
MongoDB using Grails plugin by puneet behl
Mongo db basic installation
MongoDB for Coder Training (Coding Serbia 2013)
mongo.pptx
MongoDbPpt based on python installation.
An introduction to MongoDB
Getting Started with MongoDB (TCF ITPC 2014)

More from Georges Abboudeh

PPTX
FF0316-01-johari-window-model-for-powerpoint-16x9-1.pptx
PPTX
Johari Window Coaching Slides and personality assessment
PPTX
Boosting Student Retention: Key Strategies
PPTX
Quality assurance for departments communications
PPT
introduction to database and the theory behind it ch1.ppt
PPT
Object Oriented Software Development, using c# programming language
PPTX
Course map and structure with different modules
PDF
Compendium-of-Questionaire-and-Inventories-1.pdf
FF0316-01-johari-window-model-for-powerpoint-16x9-1.pptx
Johari Window Coaching Slides and personality assessment
Boosting Student Retention: Key Strategies
Quality assurance for departments communications
introduction to database and the theory behind it ch1.ppt
Object Oriented Software Development, using c# programming language
Course map and structure with different modules
Compendium-of-Questionaire-and-Inventories-1.pdf

Recently uploaded

PPTX
NSF Converter Software to Convert NSF to PST, EML, MSG
PDF
Influence Without Power - Why Empathy is Your Best Friend.pdf
PDF
KoderXpert – Odoo, Web & AI Solutions for Growing Businesses
PDF
nsfconvertersoftwaretoconvertNSFtoPST.pdf
PDF
Here’s the case study that shows how companies lose ₹2–6 Cr annually due to m...
PDF
Advanced Prompt Engineering: The Art and Science
PPTX
application security presentation 2 by harman
PPTX
Why Your Business Needs Snowflake Consulting_ From Data Silos to AI-Ready Cloud
 
PDF
Database Management Systems(DBMS):UNIT-II Relational Data Model BCA SEP SEM ...
PDF
How Does AI Improve Location-Based Mobile App Development for Businesses.pdf
PPTX
Deep Dive into Durable Functions, presented at Cloudbrew 2025
PDF
Operating System (OS) :UNIT-I Introduction to Operating System BCA SEP SEM-II...
PDF
Code, Coins and Collaboration: How Open Source Shapes Modern Finance.
PPTX
Modern Claims Automation Solutions for Operational Agility
PPTX
#15 All About Anypoint MQ - Calicut MuleSoft Meetup Group
PPTX
Reimagining Service with AI Voice Agents | Webinar
PDF
Digitizing Banquet Management_ Why It Matters for Modern Hotels.pdf
PPTX
Lecture 3 - Scheduling - Operating System
PDF
From Boroughs to Browsers: Naresh Ramaiya’s Digital Journey
PDF
Blueprint to build quality before the code exists - StackConnect Milan 2025
NSF Converter Software to Convert NSF to PST, EML, MSG
Influence Without Power - Why Empathy is Your Best Friend.pdf
KoderXpert – Odoo, Web & AI Solutions for Growing Businesses
nsfconvertersoftwaretoconvertNSFtoPST.pdf
Here’s the case study that shows how companies lose ₹2–6 Cr annually due to m...
Advanced Prompt Engineering: The Art and Science
application security presentation 2 by harman
Why Your Business Needs Snowflake Consulting_ From Data Silos to AI-Ready Cloud
 
Database Management Systems(DBMS):UNIT-II Relational Data Model BCA SEP SEM ...
How Does AI Improve Location-Based Mobile App Development for Businesses.pdf
Deep Dive into Durable Functions, presented at Cloudbrew 2025
Operating System (OS) :UNIT-I Introduction to Operating System BCA SEP SEM-II...
Code, Coins and Collaboration: How Open Source Shapes Modern Finance.
Modern Claims Automation Solutions for Operational Agility
#15 All About Anypoint MQ - Calicut MuleSoft Meetup Group
Reimagining Service with AI Voice Agents | Webinar
Digitizing Banquet Management_ Why It Matters for Modern Hotels.pdf
Lecture 3 - Scheduling - Operating System
From Boroughs to Browsers: Naresh Ramaiya’s Digital Journey
Blueprint to build quality before the code exists - StackConnect Milan 2025

No SQL DB lecture showing structure and syntax

  • 1.
    What is NoSQL?1NoSQL= "Not Only SQL“Designed for:Big DataReal-time web appsFlexible data modelsEmphasizes scalability, performance, andflexibility
  • 2.
    2Why NoSQL?Limitations oftraditional SQL:Fixed schemasPoor horizontal scalingAdvantages of NoSQL:Schema-less modelsHigh performanceEasy replication and partitioning
  • 3.
    Types of NoSQL•Key-value• Graph database• Document-oriented• Column family3
  • 4.
    Use Cases forNoSQL Social networks IoT applications Real-time analytics Product catalogs Content Management Systems (CMS)
  • 5.
    How does NoSQLvary from RDBMS?10SQL NoSQLRelational Database Management System (RDBMS) Non-relational or distributed database system.These databases have fixed or static or predefined schema They have dynamic schemaThese databases are best suited for complex queries These databases are not so good for complex queriesVertically Scalable Horizontally scalableFollows ACID property Follows BASE property NoSQL (often interpreted as Not only SQL) database It provides a mechanism for storage and retrieval of data that is modeledin means other than the tabular relations used in relational databases.
  • 6.
  • 7.
    Introduction to MongoDB7Document-oriented NoSQL DB Stores data in BSON (Binary JSON) Created by MongoDB Inc. Open-source with enterprise editions
  • 8.
    MongoDB Key FeaturesDynamic schema (schema-less) Horizontal scalability via sharding Built-in replication Powerful query language Integration with popular languages (Python, Node.js, Java,etc.)
  • 9.
    RDB Concepts toNO SQL22RDBMS MongoDBDatabase DatabaseTable, View CollectionRow Document (BSON)Column FieldIndex IndexJoin Embedded DocumentForeign Key ReferencePartition ShardCollection is notstrict about whatit StoresSchema-lessHierarchy isevident in thedesignEmbeddedDocument?
  • 10.
    10Download and installhttps://www.mongodb.com/try/download/communityMongoDBServerMongoDB Shellhttps://www.mongodb.com/try/download/shell
  • 11.
    11Create Database Afterconnecting to your database using mongosh, you can see whichdatabase you are using by typing db in your terminal. Show all databases To see all available databases, in your terminal type show dbs Change or Create a Database You can change or create a new database by typing use then the name of thedatabase.
  • 12.
    12Create Collection Method1 You can create a collection using the createCollection() database method. Method 2 You can also create a collection during the insert process.
  • 13.
    13Insert Documents Thereare 2 methods to insert documents into a MongoDB database. insertOne(): To insert a single document, use the insertOne() method. insertMany(): To insert multiple documents at once, use the insertMany()method.
  • 14.
    14Find Find Data:There are 2 methods to find and select data from a MongoDBcollection, find() and findOne(). To select data from a collection in MongoDB, we can use the find() method. This method accepts a query object. If left empty, all documents will be returned. To select only one document, we can use the findOne() method. This method accepts a query object. If left empty, it will return the first documentit finds.
  • 15.
  • 16.
    16Projection Both findmethods accept a second parameter called projection. This parameteris an object that describes which fields to include in the results.
  • 17.
    17Projection We usea 1 to include a field and 0 to exclude a field. Notice that the _id field is also included. This field is always included unlessspecifically excluded.
  • 18.
    18Projection Let's excludethe date category field. All other fields will be included in the results. We will get an error if we try to specify both 0 and 1 in the same object.
  • 19.
    19Update Document Toupdate an existing document we can use the updateOne() or updateMany()methods. The first parameter is a query object to define which document or documentsshould be updated. The second parameter is an object defining the updated data. The updateOne() method will update the first document that is found matchingthe provided query.
  • 20.
    20Update DocumentInsert ifnot found: If you would like to insert the document if it is not found,you can use the upsert option.
  • 21.
    21Update Document updateMany():The updateMany() method will update all documents that matchthe provided query.
  • 22.
    22Delete Documents deleteOne():The deleteOne() method will delete the first document that matchesthe query provided. deleteMany(): The deleteMany() method will delete all documents that match thequery provided.
  • 23.
    23MongoDB Query OperatorsNameDescription$eq Matches value that are equal to a specified value$gt, $gte Matches values that are greater than (or equal to a specifiedvalue$lt, $lte Matches values less than or ( equal to ) a specified value$ne Matches values that are not equal to a specified value$in Matches any of the values specified in an array$nin Matches none of the values specified in an array$or Joins query clauses with a logical OR returns all$and Join query clauses with a loginal AND$not Inverts the effect of a query expression$nor Join query clauses with a logical NOR$exists Matches documents that have a specified field$regex Allows the use of regular expressions when evaluating field values$text Performs a text search$where Uses a JavaScript expression to match documents
  • 24.
  • 25.
    25Update Operators Fields:The following operators can be used to update fields: $currentDate: Sets the field value to the current date $inc: Increments the field value $rename: Renames the field $set: Sets the value of a field $unset: Removes the field from the document Array: The following operators assist with updating arrays. $addToSet: Adds distinct elements to an array $pop: Removes the first or last element of an array $pull: Removes all elements from an array that match the query $push: Adds an element to an array
  • 26.
    26ExampleSet the lastUpdatedfield to the current date:
  • 27.
    27ExampleIncrement likes by1:Rename body to content:Set a new field status to "published":Remove the category field:
  • 28.
    28ExampleAdd a tagonly if it’s not already present:Remove last element of the tags array:Remove first element:Remove "news" from the tags array:Add "announcement" to the tags array:

Editor's Notes

  • #3 Key-Value StoresDefinition: Store data as a collection of key-value pairs. Highly performant and simple.Examples:Redis: In-memory store, often used for caching, real-time analytics, and messaging.Riak: Distributed and fault-tolerant, designed for high availability.Graph DatabasesDefinition: Designed for data with complex relationships. Data is stored as nodes and edges.Examples:Neo4j: Popular graph database, ideal for social networks, recommendation engines.HyperGraphDB: A generalized graph database with support for hypergraphs. Document-Oriented DatabasesDefinition: Store semi-structured data as documents, typically in JSON or BSON format.Examples:MongoDB: Widely used, flexible schema, good for content management, IoT, etc.CouchDB: Focuses on ease of use and multi-master replication.Column Family StoresDefinition: Store data in columns rather than rows, suitable for large-scale distributed systems.Examples:Cassandra: High scalability, fault-tolerant, used by Facebook, Netflix.HBase: Built on Hadoop, good for big data analytics. SummaryEach NoSQL type is optimized for specific use cases:Key-value: Fast lookupsGraph: Relationship-heavy dataDocument: Flexible schemasColumn family: Massive datasets with complex queries

[8]ページ先頭

©2009-2025 Movatter.jp