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
Mongo Nosql CRUD Operations
PPTX
Introduction To MongoDB
PDF
full stack modul 5, mongodb,webpack,front-end,back-end
PPTX
Introduction to MongoDB – A NoSQL Database
PPTX
Introduction to MongoDB
PPTX
Getting Started with MongoDB
PPTX
Mongo db
PPTX
mongodb introduction11111111111111111111
PPTX
MONGODB koko ko kok k ok kk ok okoko.pptx
PPTX
MongoDB installation,CRUD operation & JavaScript shell
PPS
MongoDB crud
PDF
An introduction to MongoDB
PPTX
MongoDB using Grails plugin by puneet behl
PPTX
Mongo db queries
PPTX
mongo.pptx
PDF
MongoDB for Coder Training (Coding Serbia 2013)
PPTX
MongoDB_ppt.pptx
PPTX
Mongo db basic installation
PPTX
lecture_34e.pptx
PPTX
UNIT-1 MongoDB.pptx
PPT
9. Document Oriented Databases
PDF
Mongo db basics
PPTX
MongoDbPpt based on python installation.
PPT
Mongo db basics
PDF
MongoDB.pdf54teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeer
PPT
MongoDB
PPTX
MongoDB - An Introduction
PDF
Getting Started with MongoDB (TCF ITPC 2014)
PPT
Object Oriented Software Development, using c# programming language
PPT
introduction to database and the theory behind it ch1.ppt

More Related Content

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

Similar to No SQL DB lecture showing structure and syntax

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

More from Georges Abboudeh

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

Recently uploaded

PPTX
Application Security – Static Application Security Testing (SAST)
PPTX
Deep Dive into Durable Functions, presented at Cloudbrew 2025
PDF
Red Hat Summit 2025 - Triton GPU Kernel programming.pdf
PDF
Ch2 -ENG.pdf COMPUTER ARCHITECTURE L2 INFO
PDF
Database Management Systems(DBMS):UNIT-II Relational Data Model BCA SEP SEM ...
PDF
Database Management Systems(DBMS):UNIT-I Introduction to Database(DBMS) BCA S...
PDF
PeopleSoft Lift and Shift to Oracle Cloud Infrastructure.pdf
PDF
nsfconvertersoftwaretoconvertNSFtoPST.pdf
PDF
How Does AI Improve Location-Based Mobile App Development for Businesses.pdf
PPTX
Magnet-AXIOM_overview_tool_cyber_tool.pptx
PPTX
Struggling with Pentaho Limitations How Helical Insight Solves Them.pptx
PPTX
Reimagining Service with AI Voice Agents | Webinar
PPTX
AI Clinic Management Software for Otolaryngology Clinics Bringing Precision, ...
PDF
Blueprint to build quality before the code exists - StackConnect Milan 2025
PPTX
application security presentation 2 by harman
PDF
Resource-Levelled Critical-Path Analysis Balancing Time, Cost and Constraints
PDF
API_SECURITY CONSULTANCY SERVICES IN USA
PPTX
Lecture 3 - Scheduling - Operating System
PDF
Cloud-Based Underwriting Software for Insurance
PDF
SecureChain AI (SCAI) Token – Smart Contract Security Audit Report by EtherAu...
Application Security – Static Application Security Testing (SAST)
Deep Dive into Durable Functions, presented at Cloudbrew 2025
Red Hat Summit 2025 - Triton GPU Kernel programming.pdf
Ch2 -ENG.pdf COMPUTER ARCHITECTURE L2 INFO
Database Management Systems(DBMS):UNIT-II Relational Data Model BCA SEP SEM ...
Database Management Systems(DBMS):UNIT-I Introduction to Database(DBMS) BCA S...
PeopleSoft Lift and Shift to Oracle Cloud Infrastructure.pdf
nsfconvertersoftwaretoconvertNSFtoPST.pdf
How Does AI Improve Location-Based Mobile App Development for Businesses.pdf
Magnet-AXIOM_overview_tool_cyber_tool.pptx
Struggling with Pentaho Limitations How Helical Insight Solves Them.pptx
Reimagining Service with AI Voice Agents | Webinar
AI Clinic Management Software for Otolaryngology Clinics Bringing Precision, ...
Blueprint to build quality before the code exists - StackConnect Milan 2025
application security presentation 2 by harman
Resource-Levelled Critical-Path Analysis Balancing Time, Cost and Constraints
API_SECURITY CONSULTANCY SERVICES IN USA
Lecture 3 - Scheduling - Operating System
Cloud-Based Underwriting Software for Insurance
SecureChain AI (SCAI) Token – Smart Contract Security Audit Report by EtherAu...

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