4. 1. Centralised Database
• The information(data) is stored at a centralized location and
the users from different locations can access this data.
• This type of database contains application procedures that
help the users to access the data even from a remote
location.
5. Distributed Database
•Just opposite of the centralized database concept,
•The data is not at one place and is distributed at various
sites of an organization. These sites are connected to
each other with the help of communication links which
helps them to access the distributed data easily.
6. Introduction to NoSQL
•NoSQL is a type of database management
system (DBMS) that is designed to handle and
store large volumes of unstructured and semi-
structured data.
•NoSQL originally referred to “non-SQL” or “non-
relational” databases
7. NoSQL Database
•It is used for large sets of distributed data.
•There are some big data performance issues which are
effectively handled by relational databases, such kind of
issues are easily managed by NoSQL databases.
•There are very efficient in analyzing large size unstructured
data that may be stored at multiple virtual servers of the
cloud.
8. Cloud and Database
• A cloud is a network of remote servers that are connected to the
internet, and are used to store, manage and process data.
• Cloud services can be divided into three categories:
• Infrastructure as a Service (IaaS),
• Platform as a Service (PaaS) and
• Software as a Service (SaaS). T
• he main benefit of cloud computing is its scalability, as well as its
ability to provide on-demand access to computing resources and
services.
9. Cloud and Database
• A database is a collection of data that is organized in a specific way
and can be accessed, managed and updated by a software
application.
• Databases are used to store and retrieve data in an efficient and
organized manner.
• There are different types of databases, such as
• relational databases (MySQL, Oracle, MS SQL), NoSQL databases
(MongoDB, Cassandra, Redis) and graph databases (Neo4j).
10. Cloud and Database
•cloud is a type of technology that provides access to
remote servers and computing resources
•database is a collection of data that is organized and
managed by a specific software.
•While they are different, they can be used together,
such as running a database in a cloud environment.
12. JSON / JavaScript Object Notation Basics
• It is a text-based data exchange format.
• It is a collection of key-value pairs
• where the key must be a string type, and the value can be of any of the
following types:
• Number
• String
• Boolean
• Array
• Object
• null
18. MongoDB
• MongoDB is a NoSQL database.
• MongoDB is an open source, document oriented database
that stores data in form of documents (key and value pairs).
19. Fields (key and value pairs) are stored in document, documents are
stored in collection and collections are stored in database.
21. CRUD operations in MongoDB
• Create: This operation allows you to insert new documents into a
MongoDB collection. A document is a data structure that consists of field-
value pairs, similar to a JSON object.
• Read: This operation allows you to retrieve data from a MongoDB
collection. You can retrieve a single document or multiple documents that
match a specific query.
• Update: This operation allows you to modify existing documents in a
MongoDB collection. You can update one or multiple documents that
match a specific query.
• Delete: This operation allows you to remove documents from a MongoDB
collection. You can delete a single document or multiple documents that
match a specific query.
22. Download MongoDB
•download MongoDB from the official website:
https://www.mongodb.com/download-center/communi
ty
.
• MongoDB driver for our programming language.
•using the official MongoDB driver for Node.js.
•You can install it by running the following command:
npm install mongodb
npm install mongoose
27. Step 1 : Check properly installed or not
Open cmd and type:
•mongod -version
•mongo -version
28. Step 2 : Server on & Client on
Open two separate cmd and type: One for server & another for
client
• mongod
• mongo
29. Within Mongo (Client) window
Shows databases
show dbs
Ans:
admin 0.000GB
config 0.000GB
local 0.000GB
36. MongoDB – sort() Method
• The sort() method specifies the order in which the query returns the
matching documents from the given collection.
db.Collection_Name.sort({filed_name:1 or -1})
db.student.find().sort({age:1})
• Parameter:
The value is 1 or -1 that specifies an ascending or descending
sort respectively. The type of parameter is a document.
37. Connect Node.js with NoSQL MongoDB
Database
Install mongoose:
• Step 1: install the mongoose module. You can install this package by using this
command.
npm install mongoose
• Step 2: Now you can import the mongoose module in your file using:
const mongoose = require('mongoose');
38. Mongoose Module Introduction
•It provides several functions in order to
manipulate the documents of the collection of
the MongoDB database
39. Mongoose
• Mongoose is an Object Data Modeling (ODM) tool designed
to work in an asynchronous environment.
• Mongoose schema as a blueprint for defining the structure
of a Mongoose model that maps directly to a MongoDB
collection.
40. • -->unifiedtopology : DeprecationWarning: current Server Discovery and
Monitoring engine is deprecated, and will be removed in a future version.
• To use the new Server Discover and Monitoring engine, pass option
{ useUnifiedTopology: true } to the MongoClient constructor.
• -->usenewurlparser : DeprecationWarning: current URL string parser is
deprecated, and will be removed in a future version. To use the new parser,
pass option { useNewUrlParser: true } to MongoClient.connect.
41. Step 1 : create schema and set model
const mongoose =require("mongoose")
const url = "mongodb://localhost:27017/project";
const name = new mongoose.Schema({ name: String,
age:Number, rollno:String });
const Name= mongoose.model('Name',name)