SlideShare a Scribd company logo
NOSQL
ROXANA TADAYON
05/04/2017
Outline
 Key-Values stores
 Document-Oriented Databases
 Column Family Stores
 Graph
Physical models, Architecture
What is NOSQL?
Stands for Not Only SQL
built in the early 2000s for the purpose
of large-scale database clustering in
cloud and web applications.
 Class of non-relational data storage
systems
 Usually do not require a fixed table
schema nor do they use the concept of
joins
https://db-engines.com/en/ranking
Why NOSQL
Relational Database Management System doesn’t have the
ability /capacity to handle:
The numbers of concurrent users
The amount of new data type such as unstructured data, stream data,
semi structured data
The continual increase in the amount of data that have been provided by
mobile, social media, geo-location data.
Why NOSQL
The foundation of relational databases are based on 'Normalization'
and multiple 'Join Operations' for each query and then when the
number of users and data increase, relational databases led to create
a numerous amount of tables that are uncontrollable and really hard
to manage
Normalization?!
Join?!
The relational model is not sufficient
A new generation of databases
How do NOSQL Databases should
store/Manage this storm?
Next Generation Databases mostly addressing some of the points:
 Being non-relational
 Horizontally scalable- can dynamically support rapidly growing
 Distributed
 Open-source
 Schema-free
 Agile development methods
 Easy replication support
 Simple API
 High Availability
 Simple to install and operate
 Follow BASE principle
 (not ACID - Atomicity,
Consistency, Isolation, Durability).
BASE
Basically Available:
Availability is more important
than consistency.
Soft State: Higher
availability results in an
eventual consistent state
Eventually Consistent: if
now new updates are made to
a given data item, eventually all
accesses to that item will return
the last updated value
RDBMS vs NoSQL
RDBMS
 Structured and organized
data
 Structured query
language (SQL)
 Data and its relationships
are stored in separate
tables.
 Data Manipulation
Language, Data Definition
Language
Join & Normalization
 Tight Consistency
ACID Transaction
NoSQL
Unstructured, Semi structured and Real
time data
No declarative query language
Flexible schema
Many Model: KVS, Graph, and etc.
Prioritizes high performance high
availability and scalability
Distributed
Horizontally scalable
 Lower Cost
Open source
No Complicate relationship
(Join, Normalization)
Eventual consistency
rather ACID property
 CAP Theorem.
CAP Theorem
Consistency: All nodes see the
same data at the same time
Availability: Every request
receives a response
Partition Tolerance : The
system continues to operate
despite arbitrary message loss
or failure of part of the system.
Impossible to have all 3
requirements met.
At most two of Consistency,
Availability, and Partition-
tolerance.
NoSQL Categories
Key-value stores
Document oriented
Column Family Stores
Graph
Job Trends & Popularity
Trends
Document-Oriented Databases
Document-Oriented Databases
 Documents are the main concept.
 A Document-Oriented database stores and retrieves documents in some standard
format(s):
 JSON
 XML
 BSON
 YAML
 Binary forms (like PDF and MS Word).
 Document is similar to row or record in relation DB, but more flexible (Documents have
differences in their attributes).
 Document are indexed
 Document databases store documents in the value part of the key-value
{
name:”Robert ”, Key:Value
Age:55, ”, Key:Value
Department :[“Emergency”, “Heart Center”] Key:Value
}
The best known examples of Document-Oriented
Databases
MONGO DB
MongoDB Overview
 MongoDB is a scalable and high-performance open source database.
 MongoDB can Store complex documents as arrays, hash tables, integers, objects and
every thing else supported by JSON .
 Written in C++
 Has driver to all most every popular language programming
 Full Index Support
 Built-In Replication & Cluster Management
 Data redundancy
 Fault tolerant (automatic failover AND recovery)
 Consistency (wait-for-propagate or write-and-forget)
 Simplified maintenance
 Distributed Storage (Sharding)
 Base on define shard key.
 It’s enabling horizontal scaling across multiple nodes.
 Auto-Balances as shard servers are added or removed
 Failover handled through replica sets.
 Map Reduce queries are run in parallel across shards.
MongoDB in
many ways “feels”
like an RDMS
Who is using MongoDB?
RDBMS vs MongoDB
RDBMS vs MongoDB
Relational MongoDBl
MongoDB Advantages
 To reduce complexity
 Get rid of migrations
 No create table
 No alter column
 No add column
 No change column
 Get rid of relationships
 Many to one/ One to Many/ Many to Many
 Reduce number of database requests
 Joined
 Rich queries
 In-place updates
 JSON
 MongoDB knows JSON
 Don’t have to convert data from / to JSON
 Adapt to changes
 Changes in schema
 Changes in data & algorithms $set, $unset, $push, $rename,
 Changes for performance & scaling
Data Types
 String : This is most commonly used datatype to store the data. String in mongodb
must be UTF-8 valid.
 Integer : This type is used to store a numerical value. Integer can be 32 bit or 64 bit
depending upon your server.
 Boolean : This type is used to store a boolean (true/ false) value.
 Double : This type is used to store floating point values.
 Min/ Max keys : This type is used to compare a value against the lowest and highest
BSON elements.
 Arrays : This type is used to store arrays or list or multiple values into one key.
 Timestamp : ctimestamp. This can be handy for recording when a document has been
modified or added.
 Object : This datatype is used for embedded documents.
 Null : This type is used to store a Null value.
 Symbol : This datatype is used identically to a string however, it's generally reserved
for languages that use a specific symbol type.
 Date : This datatype is used to store the current date or time in UNIX time format. You
can specify your own date time by creating object of Date and passing day, month, year
into it.
 Object ID : This datatype is used to store the document’s ID.
 Binary data : This datatype is used to store binay data.
 Code : This datatype is used to store javascript code into document.
 Regular expression : This datatype is used to store regular expression
Data Modeling
MongoDB is the most similar database to relational database
regarding data Modeling, but there exists some significant
differences between the document oriented model and the
relational model:
 Flexible schema
 Lack of join in MongoDB
 Arrays & Embedded-Documents
 De-Normalization
Flexible schema
 Schema should not determine before inserting data.
 MongoDB supports a flexible schema based on the needs of
the application usage such as updates, data processing,
queries and etc.
CREATE TABLE DOCTOR(
ID VARCHAR2 (8) NOT NULL PRIMARY
KEY,
SSN VARCHAR2(11) NOT NULL unique,
F_NAME VARCHAR2 (25) NOT NULL,
L_NAME VARCHAR2 (25) NOT NULL,
Department varchar(10),
Address VARCHAR2(50) NOT NULL,
ZIP_Code NUMBER(5) NOT NULL
)
ID SSN F_NAME L_NAME Department
HOMEPHON
E
CELLPHONE BIRTH_DATE
11111112 123-98-4534 Hamid Sahat Emergency
1-555-729-
2345
693-258-
1968
15-JUN-63
11111113 199-98-2365 Chang Zhxiao CCU
1-552-729-
5236
332-258-
1456
13-APR-55
Lack of join in MongoDB
 Data spilt horizontally on different clients and
therefore, to perform so many joins on different
applications’ server is unrealistic.
 Supports a left outer join to an unsharded collection
in the same database($lookup ).
 It supports partially the relational model(Primary
key & Foreign Key)
Arrays & Embedded-Documents
• MongoDB supports the cardinality ratio by
using:
• Arrays
• Embedded documents (document with a
nested document)
db.DOCTOR.find({},{"Department":1,_id:0})
db.DOCTOR.find({},{"Degree":1,_id:0}).limit(1)
De-Normalization
 Mongo supports a de-normalization data model.
# 1#1 # 2#1
Converting relational model into
document-oriented model
Doctor
Patient
MongoDB Data Model
Create/Drop Database
'use Hospital' is used to create 'hospital' database. The command will create the database, if it
doesn't exist otherwise it will return the existing database
>db.dropDatabase()
According to delete a database we firstly should select the database (Switched to db Hospital) and then
delete it.
Create/Drop Collection
 db.createCollection
 db.createCollection(“DOCTOR”)
 MongoDB automatically creates a collection when we insert some
document.
 db.PATIENT.drop()
 If the selected collection is removed successfully, the drop() method
will return ‘true’, otherwise ‘false’ will be returned .
 db.PATIENT.remove({})
 To remove all documents from a collection, pass an empty query
document '{}' to the ’remove’ method.
 Remove() method does not remove the indexes
Insert
 db.collection.insert()
db.DOCTOR.insert(
{name:{firstname:'John', lastname:'Thomsen'},
SSN:'534-10-4534',
DOB : new Date('June 30,1948'),
Salary: 310000,
phone:{ HomePhone:'1-880-529-234', CellPhone:'443-258-1968'},
address: {street:'589 Linden st', city:'Frostburg', Zip:'21532', state:'Maryland'},
Maritalstatus:'M',
Specialties:'Oncology',
Degree:{DegreeTitle:'Doctor of Medicine',Degreefrom:'Maryland
University',Date_of_Degree: new Date('Feb 22,1988')},
Certificate:{CertificateName:'Cardic Surgery',
Date_of_Certificate: new Date('Sep 24, 1987')},
Department:['Laboratory and Blood Bank','Internal Diseases','Medical'],
Mentor:'Sara Konei'} )
Embedded Document
Embedded Document
Embedded
Document
Embedded Document
Array
Insert
Insertdb.PATIENT.insert( {
name:{firstname:'Ahmad', lastname:'Abdolahe', middelname:'Saeed'},
SSN:'33-90-1134',
DOB: new Date('April 20,1995'),
phone:{ HomePhone:'1-301-338-5986',
CellPhone:'240-501-1968'},
Address: {street:'181 Ormand Street', city:'Frostburg', Zip:'21532', state:'Maryland'},
Maritalstatus:'M',
Gender:'M',
Race:'White',
Smoker:'N',
DrivingLicense:{ DRIVERSLICENSENUM: 72585432,DRIVERSLICENSESTATE:'MD'},
INFECTION_HISTORY: { DISEASE: 'Alopecia'},
MEDICINE_HISTORY:{ MEDICINE_USED:' Ripernol ', DOSAGE: '120 ml',
START_DATE: new Date('JAN 18, 2000'), END_DATE: new Date('JUNE 03, 2001')},
ADMISSION:{ DEPARTMENT_NAME :[' Emergency ', 'Surgery'], ADMISSION_DATE:
new Date ('Feb 14,1998'), DISCHARGE_DATE : new Date ('Feb 19,1998')},
ROOM_ASSIGNED:[145,289], BED: {TYPEOFBED: 'GeneralCare', Price:90 },
INSURANCE:{POLICYNUM:'12359867', COMPANYNAME: 'Royal sun', DATEISSUED:
new Date ('JAN 14,2003'), EXPIRATIONDATE: new Date ('JAN
30,2004'),INSURANCETYPE: 'Private'},
Doctor_Info: [{Doctor_ID:db.DOCTOR.find()[0]._id},{Doctor_ID:db.DOCTOR.find()[1]. _id}]
Update
• db.collection.update()
•
db.DOCTOR.update({"Specialties" : " Anesthesia"},{$inc:{Salary:1000}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
db.PATIENT.update({"BED.Price":135},{$set:{"BED.Price":200}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
db.PATIENT.update({"name.firstname":"Nancy"},{$unset:{"INSURANCE":""}})
$set
To increment the salary by 1000 $inc
To update a field within an embedded document
To increase the salaries of all doctors who are specialist in Anesthesia
To delete a particular field $unset operator is used
db.DOCTOR.update({"Maritalstatus" : "S"},{$set:{"Maritalstatus" : "M"}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
Upsert
The UPSERT command inserts documents that don’t exist and updates the
documents that exist
Insert
Update
Aggregation & Queries
 MongoDB has a rich query framework
 find() -The result from find is a cursor that can list the fields we want to retrieve.
Aggregation & Queries
 Find() :
db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0})
{ "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } }
{ "name" : { "firstname" : "Simon", "lastname" : "Diohman" } }
{ "name" : { "firstname" : "Nancy", "lastname" : "Miller" } }
{ "name" : { "firstname" : "John", "lastname" : "Knusen" } }
 Sort()
1 uses for ascending and -1 for descending
{ "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } }
{ "name" : { "firstname" : "John", "lastname" : "Knusen" } }
{ "name" : { "firstname" : "Nancy", "lastname" : "Miller" } }
{ "name" : { "firstname" : "Simon", "lastname" : "Diohman" } }
 Skip()
 Limit()
db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1}).limit(1)
{ "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } }
 Count()
db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1})
db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1}).skip(3)
{ "name" : { "firstname" : "Simon", "lastname" : "Diohman" } }
db.PATIENT.count()
4
db.DOCTOR.count()
4
Aggregation & Queries
 Display information about the beds
db.PATIENT.find({},{_id:0,BED:1})
 Select the patient’s names that do not have insurance
db.PATIENT.find( { INSURANCE: { $exists:false } }, {"name.firstname":1, "name.lastname":1, _id:0} )
 Display the name of doctors who graduated between March 1, 2000 and March 1, 2010
>start= new Date("March/01/2000")
ISODate("2000-02-29T23:00:00Z")
> end= new Date("March/01/2010")
ISODate("2010-02-28T23:00:00Z")
db.DOCTOR.find({"Degree.Date_of_Degree":{"$gte":start,"$lt":end}},{_id:0,"name.firstname":1,"name.lastname":1,
"Degree.Date_of_Degree":1}).pretty()
new Date("<YYYY-mm-dd>") returns the specified date string ("<YYYY-mm-dd>")
as a Date object.
The Date is wrapped by ISODate helper.
Aggregation Pipeline
 Aggregation pipeline is a way to transform/combine documents in a
collection.
MongoDB Aggregation Operators SQL Terms, Function, and Concepts
$match WHERE
$group GROUP BY
$match HAVING
$project SELECT
$lookup LEFT OUTER JOIN
Db.collection.aggregate{$ Aggregation Operator :Field}
Aggregation & Queries
 Display doctors' name (three) sorted by Specialties (desc)
db.DOCTOR.aggregate( [ { $project: {_id:0,Specialties:1,Name_Of_Doctor:
{$concat:[ "$name.firstname", " " ,"$name.lastname"]}}},{$sort:{"Specialties": -
1}},{$limit:3}])
db.DOCTOR.find({},{"name.firstname":1,"firstname":1,"Specialties": 1,_id:0}).sort(
{ Specialties: 1 } ).limit(5)
$concat?
{ "Specialties" : "Urology", "Name_Of_Doctor" : "Robert Orndorff" }
{ "Specialties" : "Oncology", "Name_Of_Doctor" : "John Thomsen" }
{ "Specialties" : " Anesthesia", "Name_Of_Doctor" : "Mary
Donaldson" }
Aggregation & Queries
 Display the total price of beds for each patient
db.PATIENT.aggregate( [ { $group: { _id:{$concat:[
"$name.firstname", "-" ,"$name.lastname"]},total: { $sum:
"$BED.Price" } } } ] )
{ "_id" : "Simon-Diohman", "total" : 200 }
{ "_id" : "John-Knusen", "total" : 135 }
{ "_id" : "Nancy-Miller", "total" : 0 }
{ "_id" : "Ahmad-Abdolahe", "total" : 90 }
 Display the average doctor salaries by Maritalstatus
db.DOCTOR.aggregate([{$group:{_id:
"$Maritalstatus",Avg_Salary: { $avg: "$Salary" }}}])
{ "_id" : "S", "Avg_Salary" : 200000 }
{ "_id" : "M", "Avg_Salary" : 264000 }
Aggregation & Queries
 Display patient names and the doctors name who has been visited
 $lookup -New in version 3.2.
 lookup() method uses to join between collections
 Performs a left outer join to an unshared collection in the same database
db.PATIENT.aggregate([ {
$lookup:
{
from: "DOCTOR",
localField: "_id",
foreignField: "Doctor_ID",
as: "test_look_up"}},{$project:{_id:0,"name.firstname":1,"name.
Doctor_Info.Doctor_firstname":1, "Doctor_Info.Doctor_lastname":1}}]).pretty()
Join
Aggregation & Queries
$lookup
db.PATIENT.aggregate([ { $lookup: { from: "DOCTOR",
localField: "_id", foreignField: "Doctor_ID", as:
"test_look_up"}},{$project:{_id:0,"name.firstname":1,"nam
e.lastname":1,"name. Doctor_Info.Doctor_firstname":1,
"Doctor_Info.Doctor_lastname":1}}])
{ "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" }, "Doctor_Info" : [ {
"Doctor_lastname" : "Orndorff" }, { "Doctor_lastname" : "Thomsen" } ] }
{ "name" : { "firstname" : "Simon", "lastname" : "Diohman" }, "Doctor_Info" : [ {
"Doctor_lastname" : "Donaldson" }, { "Doctor_lastname" : "Thomsen" } ] }
{ "name" : { "firstname" : "Nancy", "lastname" : "Miller" }, "Doctor_Info" : {
"Doctor_lastname" : "Donaldson" } }
{ "name" : { "firstname" : "John", "lastname" : "Knusen" }, "Doctor_Info" : {
"Doctor_lastname" : " Mortensen" } }
Aggregation & Queries
db.DOCTOR.aggregate([{$match:{"name.firstname":"Robert"}},{$project:{Departm
ent:1, _id:1, name:1}} ]).pretty()
db.DOCTOR.aggregate([{$unwind:"$Department"},{$match:{"name.firstname":"Robert"}},{$project:{
Department:1, _id:1, name:1}} ]).pretty()
$unwind -Deconstructs an array field from the input documents to output.
A document for each element.
Aggregation & Queries
 mapReduce() is a data processing paradigm for condensing large volumes of
data into useful aggregated results. MongoDB uses mapReduce command for
map-reduce operations. MapReduce is generally used for processing large data
sets.
The map-reduce function:
Query the collection
Map a value with a key and emits a key-value pair
Reduce all the documents having the same key end up in an array
Out specifies the location of the map-reduce query result
Query specifies the optional selection criteria for selecting documents
Sort specifies the optional sort criteria
Limit specifies the optional maximum number of documents to be
returned
Array
Aggregation & Queries
Display the total amount of salary for each single doctor.
To Select single doctors
To group them on the basis of SSN
SUM the amount of salaries by each doctor
db.DOCTOR.mapReduce( function() { emit(this.SSN,this.Salary); },function(SSN,Salary)
{return Array.sum(Salary)},
{query:{Maritalstatus:"S"},out:"total_Salary_S"})
MongoDB in Practice
Personalization creates customized online experiences for the customers in real time based on
analysis of behavioral and demographic profiles, historical interactions, and preferences.
 Scratchpad automatically saves things you
view while you shop across devices
Scratchpad automates the Intelligently
remembers searches
hunts for the lowest prices
makes it easy to shop across any device
makes the travel search process fast, easy, and
personalized
 It keeps people from jumping to other travel
sites.
It dramatically increases conversion rates for
Expedia.
suppliers constantly change inventory and
pricing information behind the scenes.
create a huge volume of highly variable data.
Scratchpad APP makes the travel search process fast, easy, and personalized
MongoDB in Practice
Scratchpad in Relational database
Hotel
Car
MongoDB in PracticeMakes it possible for Expedia to
create a feature that gives every user
a relevant, seamless shopping
experience. That collects highly-
dynamic customer information in
real-time and presents personalized
offers on fly.
Flexible document store and
simple horizontal scale-out
Makes it easy to store any
combination of city pairs, dates and
destinations. Expedia can even
continue shopping for someone
after that customer has closed out a
session. When the customer
returns, all the latest pricing and
availability for their searches are
displayed side by side on their
Scratchpad.
MongoDB’s flexible data model
Graph Database
Graph Databases
A Graph is a set of nodes and the
relationships that connect those nodes
 Nodes and Relationships contain
properties to represent data.
Properties are key-value pairs to
represent data.
Nodes can be labeled
A graph database stores data in a graph
Each node knows its adjacent nodes
As the number of nodes increases, the
cost of a local step (or hop) remains the
same
The best known examples of Graph Database
RDBMS Vs Graph Database
Why use a graph database?
 Greater performance – compared to NoSQL stores or relational
databases, graph databases offer much faster access to complex
connected data, mainly as they lack expensive ‘join’ operations. In
one example, a graph database was 1000x faster than a relational
database when working with a query depth of four.
 Lower latency – users of graph databases experience lower levels
of latency. As the nodes and links ‘point’ to one another, millions of
related records can be traversed per second and query response
time remains constant irrespective of the overall database size.
 Flexible and agile – a graph database should closely match the
structure of the data it uses. This allows developers to start work
sooner without the added complexity of mapping data across
tables.
 Good for semi-structured data – graph databases are schema
free, meaning patchy data, or data with exceptional attributes, don’t
pose a structural problem.
Neo4j
Neo4j Overview
 Neo4j is world’s leading graph databases
 Neo Technology is creator of Neo4j
 Follows Property Graph Data Model
 Is written in Java Language.
 CQL(Cypher Query Language) as query
language
 An open source
 Schema-free
 Full ACID
 High Availability
 Supports highly connected data
 It provides REST API to be accessed by any
Programming Language like Java.
Who is using Neo4j?
Advantages of Neo4j
 Easy to model and store relationships
 CQL query language commands are very easy to learn.
 It is very easy to represent connected data.
 It is very easy and faster to retrieve/traversal/navigation data
 It represents semi-structured data very easily.
 Intuitiveness- In humane readable format
 Speed
 It uses simple and powerful data model.
 Performance of relationship traversal remains constant with
growth in data size
 Fast agile development and evolution-It has a naturally
adaptive model
 Scalability-Neo4j scales up and out, supporting tens of
billions of nodes and relationships, and hundreds of
thousands of ACID transactions per second
Property Value Types
 Properties are named values where the name is a string.
 Property values can be either a primitive or an array of one primitive
type.For example String, int and int[] values are valid for properties
NULL is not a valid property value
NULL s can instead be modeled by the absence of a key
Converting relational model into
Graph model
#1 Drop Foreign Keys #2 Join Tables become relationships
#3 Attributes Properties
AdmitTO
VisitBY
WorkIN
Mentor
Converting relational model into
Graph model
Department
Doctor
Patient
WorkIN
AdmitTO
VisitBY
Mentor
Converting relational model into
Graph model
Create a node
MATCH (p: Patient)where p.name= 'Simon Diohman' RETURN p
CREATE (p:Patient{ name : 'Simon Diohman', SSN :'51-90-1134', CellPhone:'443-501-
1968',DOB:'1959-06-20' }) RETURN p
Create a relationship
Delete
Delete all nodes and relationships
Delete single node
Delete a specific node
Delete relationship
Delete a node with all its relationships
Remove
 The REMOVE clause is used to remove properties
and labels from graph elements.
Update
 The SET clause is used to update properties on nodes and relationships.
Set a property-To set a property on a node or relationship
Coping properties between nodes
The Simon node has had all it’s properties replaced by the properties in the Simon node
Update a relationship
r
r1
Hospital Graph database
Aggregation
Average
Sum
Returns the total salaries of all doctors
Collection functions
 Collection functions return collections of nodes,
relationships and etc. in a path.
 RELATIONSHIPS
Returns all nodes in a path.
Returns all relationships in a path.
Neo4j in Practice
Insurance Fraud
 Insurance Fraud is the filing of a false
claim to life, health, automobile, property,
workers' compensation or other types of
insurance benefits.
 Insurance fraud is a significant and costly problem for both
policyholders and insurance companies.
 Insurance companies lose millions of dollars each year through
fraudulent claims, largely because they do not have a way to easily
determine which claims are legitimate and which may be fraudulent.
Insurance companies shift the
risk of loss to their customers
Neo4j in Practice
Typical Scenario
 Rings of fraudsters work together to stage fake accidents.
 Such rings normally include a number of roles.
 Providers. Collusions typically involve participation from
professionals in several categories:
a. Doctors, who diagnose false injuries
b. Lawyers, who file fraudulent claims, and
c. Body shops, which misrepresent damage to cars 2.
 Participants. These are the people involved in the
(false) accident, and normally include:
a. Drivers
b. Passengers
c. Pedestrians
d. Witnesses
Neo4j in Practice
Simple 6-people collusion
Simple Ten-Person Collusion
20000$x6x3+5000$x6=390000$
The ring can claim $390000
40000$*10*4+5000$x10=1.65M
The ring can claim ?
 Fraudsters often create and manage rings by “RECYCLING” participants
so as to stage many accidents
Neo4j in Practice
To detect rings in the graph by walking the graph.
In Real Time
References
 https://www.youtube.com/watch?v=A4gRg-9jNF4
 http://www.aerospike.com/what-is-a-key-value-store/
 A. P. D. P. Ameya Nayak, "Type of NOSQL Databases and its Comparison with
Relational Databases
 vol. International Journal of Applied Information Systems (IJAIS), no. ISSN : 2249-
0868, March 2013.
 J. Kaur, "Distributed Hash Tables," 2014.
 https://www.youtube.com/watch?v=i1KAvQ-pw08.
 http://db-engines.com/en/ranking
 https://redislabs.com
 http://redis.io/
 https://www.youtube.com/watch?v=A4gRg-
9jNF4&ebc=ANyPxKoFk4OYpr8O4v1Nf2ugf-
 uEiStTzLxdMdyHf2KFxV5IuvDLA2wpMyAdsWbb9OP9H5KWwmK7wJuYe7d4cb8e3N
YMuEDsRQ
 http://www.tutorialspoint.com/redis/redis_quick_guide.htm
 http://antirez.com/news/75
 M. Paksula, "Persisting Objects in Redis Key-Value Database," University of Helsinki,
Department of
 Computer Science, Helsinki, Finland.
 http://www.lynda.com/NoSQL-tutorials/Understanding-key-value-
stores/368756/387726-4.html
 http://data-magnum.com/9-lessons-for-starting-a-big-data-initiative-and-selecting-the-
right-nosql-tools/
References
 K. Segun, &quot;The little MongoDB Book&quot;.
 https://docs.mongodb.org/manual/core/data-modeling- introduction/.
 https://docs.mongodb.org/manual/core/data-model- design/.
 T. L. MongoDB.
 https://docs.mongodb.org/manual/tutorial/query-documents/
 https://www.mongodb.com/blog/post/joins-and- other-aggregation- enhancements-
coming- in-
 mongodb-3- 2-part- 1-of- 3-introduction
 https://docs.mongodb.org/manual/reference/method/db.collection.save/
 http://www.tutorialspoint.com/mongodb/mongodb_update_document.htm
 https://docs.mongodb.org/manual/tutorial/query-documents/
 http://www.tutorialspoint.com/cassandra/cassandra_cql_datatypes.htm
 http://www.planetcassandra.org/try-cassandra/
 https://dzone.com/refcardz/apache-cassandra
 http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureDataDist
ributeReplication_c.html
 https://pdfs.semanticscholar.org/22c6/740341ef13d3c5ee52044a4fbaad911f7322.pdf
 http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-keyspaces-what-
are-they.html
 http://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_keyspace_r.html
 http://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_table_r.html
References
 http://www.slideshare.net/cjohannsen/apache-cassandra-at-the-geek2geek-berlin
 http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureIntro_c.ht
ml
 http://www.slideshare.net/planetcassandra/configuring-an-apache-cassandra-node
 http://distributeddatastore.blogspot.com/2015/08/cassandra-replication.html
 http://learn.exponential.io/courses/cassandra-consistency/lectures/98884
 http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureIntro_c.ht
ml
 http://www.slideshare.net/VaradMeru/cassandra-a-decentralized-structured-storage-
system
 https://grockdoc.com/cassandra/2.1/articles/consistency_bdd0c698-463d-4bdb-b6f7-
8118f601ba09
 https://www.cs.cornell.edu/projects/ladis2009/papers/lakshman-ladis2009.pdf
 http://learn.exponential.io/courses/cassandra-consistency/lectures/98884
 https://www.youtube.com/watch?v=-zyZ35YyT_8
 http://www.planetcassandra.org/blog/case-study-netflix/
 http://www.datastax.com/wp-content/uploads/2011/09/CS-Netflix.pdf
 http://www.3pillarglobal.com/insights/selection-criteria-for-nosql-database
 http://neo4j.com/blog/nosql-scaling-to-size-and-scaling-to-complexity/
 https://www.digitalocean.com/community/tutorials/a-comparison-of-nosql-database-
management-systems-and-models
 http://cambridge-intelligence.com/keylines/graph-databases-data-visualization/
References
 https://redislabs.com/ebook/redis-in-action/part-1-getting-started/chapter-1-getting-to-
know-redis/1-2-what-redis-data-structures-look-like/1-2-4-hashes-in-
redis#sthash.eacmDHF3.dpuf
 http://oldblog.antirez.com/post/take-advantage-of-redis-adding-it-to-your-stack.html
 http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in-
redis.html
 Http://www.tutorialspoint.com/neo4j/neo4j_overview.htm
 http://www.slideshare.net/neo4j
 http://neo4j.com/docs/stable/graphdb-neo4j.html
 http://www.slideshare.net/maxdemarzi/introduction-to-graph-databases-12735789
 http://www.slideshare.net/andres_taylor/graph-database-super-star-
8079303?qid=2cc5495e-f25a-4d99-be76-ab2ab9f6e72a&v=&b=&from_search=2
 https://www.pythian.com/blog/when-is-mongodb-the-right-choice-for-your-business-we-
explore-detailed-use-cases-2/
 Http://www.slideshare.net/mongodb/expedia-36715535
 http://www.slideshare.net/gschmutz/nosql-databases-for-implementing-data-services-
should-i-care
 http://www.datastax.com/wp-content/uploads/2011/09/CS-Netflix.pdf
 https://www.mongodb.com/document-databases
 http://www2.mta.ac.il/~kirsh/download/MTA%20NoSQL%20Seminar/Lectures/MongoD
B.pdf
 http://info.neo4j.com/rs/neotechnology/images/Fraud%20Detection%20Using%20Grap
hDB%20-%202014.pdf
 https://www.youtube.com/watch?v=hKLKpqY9UrY
 http://data-magnum.com/9-lessons-for-starting-a-big-data-initiative-and-selecting-the-
Nosql

More Related Content

What's hot

Chapter 7(documnet databse termininology) no sql for mere mortals
Chapter 7(documnet databse termininology) no sql for mere mortalsChapter 7(documnet databse termininology) no sql for mere mortals
Chapter 7(documnet databse termininology) no sql for mere mortals
nehabsairam
 
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMINGEVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
ijiert bestjournal
 
CS828 P5 Individual Project v101
CS828 P5 Individual Project v101CS828 P5 Individual Project v101
CS828 P5 Individual Project v101ThienSi Le
 
Multi-model database
Multi-model databaseMulti-model database
Multi-model database
Jiaheng Lu
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databasesArangoDB Database
 
Nosql database presentation
Nosql database  presentationNosql database  presentation
Nosql database presentation
musaab fathi
 
moving_from_relational_to_nosql_couchbase_2016
moving_from_relational_to_nosql_couchbase_2016moving_from_relational_to_nosql_couchbase_2016
moving_from_relational_to_nosql_couchbase_2016Richard (Rick) Nelson
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
ijscai
 
Database awareness
Database awarenessDatabase awareness
Database awareness
kloia
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
Tariqul islam
 
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | EdurekaSQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
Edureka!
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesQuery mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesArangoDB Database
 
NoSQL Basics and MongDB
NoSQL Basics and  MongDBNoSQL Basics and  MongDB
NoSQL Basics and MongDB
Shamima Yeasmin Mukta
 
Object Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQLObject Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQL
Shahriar Hyder
 
Backbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTPBackbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTP
Max Neunhöffer
 
NoSQL Basics - a quick tour
NoSQL Basics - a quick tourNoSQL Basics - a quick tour
NoSQL Basics - a quick tour
Bikram Sinha. MBA, PMP
 

What's hot (17)

Chapter 7(documnet databse termininology) no sql for mere mortals
Chapter 7(documnet databse termininology) no sql for mere mortalsChapter 7(documnet databse termininology) no sql for mere mortals
Chapter 7(documnet databse termininology) no sql for mere mortals
 
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMINGEVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
EVALUATING CASSANDRA, MONGO DB LIKE NOSQL DATASETS USING HADOOP STREAMING
 
Presentation1
Presentation1Presentation1
Presentation1
 
CS828 P5 Individual Project v101
CS828 P5 Individual Project v101CS828 P5 Individual Project v101
CS828 P5 Individual Project v101
 
Multi-model database
Multi-model databaseMulti-model database
Multi-model database
 
Introduction to column oriented databases
Introduction to column oriented databasesIntroduction to column oriented databases
Introduction to column oriented databases
 
Nosql database presentation
Nosql database  presentationNosql database  presentation
Nosql database presentation
 
moving_from_relational_to_nosql_couchbase_2016
moving_from_relational_to_nosql_couchbase_2016moving_from_relational_to_nosql_couchbase_2016
moving_from_relational_to_nosql_couchbase_2016
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
 
Database awareness
Database awarenessDatabase awareness
Database awareness
 
NOSQL and MongoDB Database
NOSQL and MongoDB DatabaseNOSQL and MongoDB Database
NOSQL and MongoDB Database
 
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | EdurekaSQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databasesQuery mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
 
NoSQL Basics and MongDB
NoSQL Basics and  MongDBNoSQL Basics and  MongDB
NoSQL Basics and MongDB
 
Object Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQLObject Relational Mapping with LINQ To SQL
Object Relational Mapping with LINQ To SQL
 
Backbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTPBackbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTP
 
NoSQL Basics - a quick tour
NoSQL Basics - a quick tourNoSQL Basics - a quick tour
NoSQL Basics - a quick tour
 

Similar to Nosql

No sq lv2
No sq lv2No sq lv2
No sq lv2
Nusrat Sharmin
 
2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx
RushikeshChikane2
 
nosql.pptx
nosql.pptxnosql.pptx
nosql.pptx
Prakash Zodge
 
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
RushikeshChikane2
 
Unit-10.pptx
Unit-10.pptxUnit-10.pptx
Unit-10.pptx
GhanashyamBK1
 
Comparative study of no sql document, column store databases and evaluation o...
Comparative study of no sql document, column store databases and evaluation o...Comparative study of no sql document, column store databases and evaluation o...
Comparative study of no sql document, column store databases and evaluation o...
ijdms
 
No sql – rise of the clusters
No sql – rise of the clustersNo sql – rise of the clusters
No sql – rise of the clusters
responseteam
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
Ramakant Soni
 
NOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfNOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdf
ajajkhan16
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
IJSCAI Journal
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
ijscai
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
IJSCAI Journal
 
unit2-ppt1.pptx
unit2-ppt1.pptxunit2-ppt1.pptx
unit2-ppt1.pptx
revathigollu23
 
Artigo no sql x relational
Artigo no sql x relationalArtigo no sql x relational
Artigo no sql x relational
Adenilson Lima Diniz
 
Big data technology unit 3
Big data technology unit 3Big data technology unit 3
Big data technology unit 3
RojaT4
 
the rising no sql technology
the rising no sql technologythe rising no sql technology
the rising no sql technology
INFOGAIN PUBLICATION
 
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptxDATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
Laxmi Pandya
 
Evaluation criteria for nosql databases
Evaluation criteria for nosql databasesEvaluation criteria for nosql databases
Evaluation criteria for nosql databases
Ebenezer Daniel
 
data base system to new data science lerne
data base system to new data science lernedata base system to new data science lerne
data base system to new data science lerne
tarunprajapati0t
 

Similar to Nosql (20)

No sq lv2
No sq lv2No sq lv2
No sq lv2
 
2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx2.Introduction to NOSQL (Core concepts).pptx
2.Introduction to NOSQL (Core concepts).pptx
 
nosql.pptx
nosql.pptxnosql.pptx
nosql.pptx
 
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
3.Implementation with NOSQL databases Document Databases (Mongodb).pptx
 
Unit-10.pptx
Unit-10.pptxUnit-10.pptx
Unit-10.pptx
 
Comparative study of no sql document, column store databases and evaluation o...
Comparative study of no sql document, column store databases and evaluation o...Comparative study of no sql document, column store databases and evaluation o...
Comparative study of no sql document, column store databases and evaluation o...
 
No sql – rise of the clusters
No sql – rise of the clustersNo sql – rise of the clusters
No sql – rise of the clusters
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
NOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfNOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdf
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
 
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQLA STUDY ON GRAPH STORAGE DATABASE OF NOSQL
A STUDY ON GRAPH STORAGE DATABASE OF NOSQL
 
A Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQLA Study on Graph Storage Database of NOSQL
A Study on Graph Storage Database of NOSQL
 
No sql database
No sql databaseNo sql database
No sql database
 
unit2-ppt1.pptx
unit2-ppt1.pptxunit2-ppt1.pptx
unit2-ppt1.pptx
 
Artigo no sql x relational
Artigo no sql x relationalArtigo no sql x relational
Artigo no sql x relational
 
Big data technology unit 3
Big data technology unit 3Big data technology unit 3
Big data technology unit 3
 
the rising no sql technology
the rising no sql technologythe rising no sql technology
the rising no sql technology
 
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptxDATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
DATABASE MANAGEMENT SYSTEM-MRS. LAXMI B PANDYA FOR 25TH AUGUST,2022.pptx
 
Evaluation criteria for nosql databases
Evaluation criteria for nosql databasesEvaluation criteria for nosql databases
Evaluation criteria for nosql databases
 
data base system to new data science lerne
data base system to new data science lernedata base system to new data science lerne
data base system to new data science lerne
 

Recently uploaded

Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
AlejandraGmez176757
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
ArpitMalhotra16
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
enxupq
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
benishzehra469
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive data
theahmadsaood
 

Recently uploaded (20)

Business update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMIBusiness update Q1 2024 Lar España Real Estate SOCIMI
Business update Q1 2024 Lar España Real Estate SOCIMI
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive data
 

Nosql

  • 2. Outline  Key-Values stores  Document-Oriented Databases  Column Family Stores  Graph Physical models, Architecture
  • 3. What is NOSQL? Stands for Not Only SQL built in the early 2000s for the purpose of large-scale database clustering in cloud and web applications.  Class of non-relational data storage systems  Usually do not require a fixed table schema nor do they use the concept of joins https://db-engines.com/en/ranking
  • 4. Why NOSQL Relational Database Management System doesn’t have the ability /capacity to handle: The numbers of concurrent users The amount of new data type such as unstructured data, stream data, semi structured data The continual increase in the amount of data that have been provided by mobile, social media, geo-location data.
  • 5. Why NOSQL The foundation of relational databases are based on 'Normalization' and multiple 'Join Operations' for each query and then when the number of users and data increase, relational databases led to create a numerous amount of tables that are uncontrollable and really hard to manage Normalization?! Join?! The relational model is not sufficient A new generation of databases
  • 6. How do NOSQL Databases should store/Manage this storm? Next Generation Databases mostly addressing some of the points:  Being non-relational  Horizontally scalable- can dynamically support rapidly growing  Distributed  Open-source  Schema-free  Agile development methods  Easy replication support  Simple API  High Availability  Simple to install and operate  Follow BASE principle  (not ACID - Atomicity, Consistency, Isolation, Durability). BASE Basically Available: Availability is more important than consistency. Soft State: Higher availability results in an eventual consistent state Eventually Consistent: if now new updates are made to a given data item, eventually all accesses to that item will return the last updated value
  • 7. RDBMS vs NoSQL RDBMS  Structured and organized data  Structured query language (SQL)  Data and its relationships are stored in separate tables.  Data Manipulation Language, Data Definition Language Join & Normalization  Tight Consistency ACID Transaction NoSQL Unstructured, Semi structured and Real time data No declarative query language Flexible schema Many Model: KVS, Graph, and etc. Prioritizes high performance high availability and scalability Distributed Horizontally scalable  Lower Cost Open source No Complicate relationship (Join, Normalization) Eventual consistency rather ACID property  CAP Theorem.
  • 8. CAP Theorem Consistency: All nodes see the same data at the same time Availability: Every request receives a response Partition Tolerance : The system continues to operate despite arbitrary message loss or failure of part of the system. Impossible to have all 3 requirements met. At most two of Consistency, Availability, and Partition- tolerance.
  • 9. NoSQL Categories Key-value stores Document oriented Column Family Stores Graph
  • 10. Job Trends & Popularity Trends
  • 12. Document-Oriented Databases  Documents are the main concept.  A Document-Oriented database stores and retrieves documents in some standard format(s):  JSON  XML  BSON  YAML  Binary forms (like PDF and MS Word).  Document is similar to row or record in relation DB, but more flexible (Documents have differences in their attributes).  Document are indexed  Document databases store documents in the value part of the key-value { name:”Robert ”, Key:Value Age:55, ”, Key:Value Department :[“Emergency”, “Heart Center”] Key:Value }
  • 13. The best known examples of Document-Oriented Databases
  • 15. MongoDB Overview  MongoDB is a scalable and high-performance open source database.  MongoDB can Store complex documents as arrays, hash tables, integers, objects and every thing else supported by JSON .  Written in C++  Has driver to all most every popular language programming  Full Index Support  Built-In Replication & Cluster Management  Data redundancy  Fault tolerant (automatic failover AND recovery)  Consistency (wait-for-propagate or write-and-forget)  Simplified maintenance  Distributed Storage (Sharding)  Base on define shard key.  It’s enabling horizontal scaling across multiple nodes.  Auto-Balances as shard servers are added or removed  Failover handled through replica sets.  Map Reduce queries are run in parallel across shards. MongoDB in many ways “feels” like an RDMS
  • 16. Who is using MongoDB?
  • 18.
  • 19.
  • 20.
  • 22.
  • 23. MongoDB Advantages  To reduce complexity  Get rid of migrations  No create table  No alter column  No add column  No change column  Get rid of relationships  Many to one/ One to Many/ Many to Many  Reduce number of database requests  Joined  Rich queries  In-place updates  JSON  MongoDB knows JSON  Don’t have to convert data from / to JSON  Adapt to changes  Changes in schema  Changes in data & algorithms $set, $unset, $push, $rename,  Changes for performance & scaling
  • 24. Data Types  String : This is most commonly used datatype to store the data. String in mongodb must be UTF-8 valid.  Integer : This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.  Boolean : This type is used to store a boolean (true/ false) value.  Double : This type is used to store floating point values.  Min/ Max keys : This type is used to compare a value against the lowest and highest BSON elements.  Arrays : This type is used to store arrays or list or multiple values into one key.  Timestamp : ctimestamp. This can be handy for recording when a document has been modified or added.  Object : This datatype is used for embedded documents.  Null : This type is used to store a Null value.  Symbol : This datatype is used identically to a string however, it's generally reserved for languages that use a specific symbol type.  Date : This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.  Object ID : This datatype is used to store the document’s ID.  Binary data : This datatype is used to store binay data.  Code : This datatype is used to store javascript code into document.  Regular expression : This datatype is used to store regular expression
  • 25. Data Modeling MongoDB is the most similar database to relational database regarding data Modeling, but there exists some significant differences between the document oriented model and the relational model:  Flexible schema  Lack of join in MongoDB  Arrays & Embedded-Documents  De-Normalization
  • 26. Flexible schema  Schema should not determine before inserting data.  MongoDB supports a flexible schema based on the needs of the application usage such as updates, data processing, queries and etc. CREATE TABLE DOCTOR( ID VARCHAR2 (8) NOT NULL PRIMARY KEY, SSN VARCHAR2(11) NOT NULL unique, F_NAME VARCHAR2 (25) NOT NULL, L_NAME VARCHAR2 (25) NOT NULL, Department varchar(10), Address VARCHAR2(50) NOT NULL, ZIP_Code NUMBER(5) NOT NULL ) ID SSN F_NAME L_NAME Department HOMEPHON E CELLPHONE BIRTH_DATE 11111112 123-98-4534 Hamid Sahat Emergency 1-555-729- 2345 693-258- 1968 15-JUN-63 11111113 199-98-2365 Chang Zhxiao CCU 1-552-729- 5236 332-258- 1456 13-APR-55
  • 27. Lack of join in MongoDB  Data spilt horizontally on different clients and therefore, to perform so many joins on different applications’ server is unrealistic.  Supports a left outer join to an unsharded collection in the same database($lookup ).  It supports partially the relational model(Primary key & Foreign Key)
  • 28. Arrays & Embedded-Documents • MongoDB supports the cardinality ratio by using: • Arrays • Embedded documents (document with a nested document) db.DOCTOR.find({},{"Department":1,_id:0}) db.DOCTOR.find({},{"Degree":1,_id:0}).limit(1)
  • 29. De-Normalization  Mongo supports a de-normalization data model. # 1#1 # 2#1
  • 30. Converting relational model into document-oriented model Doctor Patient
  • 32. Create/Drop Database 'use Hospital' is used to create 'hospital' database. The command will create the database, if it doesn't exist otherwise it will return the existing database >db.dropDatabase() According to delete a database we firstly should select the database (Switched to db Hospital) and then delete it.
  • 33. Create/Drop Collection  db.createCollection  db.createCollection(“DOCTOR”)  MongoDB automatically creates a collection when we insert some document.  db.PATIENT.drop()  If the selected collection is removed successfully, the drop() method will return ‘true’, otherwise ‘false’ will be returned .  db.PATIENT.remove({})  To remove all documents from a collection, pass an empty query document '{}' to the ’remove’ method.  Remove() method does not remove the indexes
  • 34. Insert  db.collection.insert() db.DOCTOR.insert( {name:{firstname:'John', lastname:'Thomsen'}, SSN:'534-10-4534', DOB : new Date('June 30,1948'), Salary: 310000, phone:{ HomePhone:'1-880-529-234', CellPhone:'443-258-1968'}, address: {street:'589 Linden st', city:'Frostburg', Zip:'21532', state:'Maryland'}, Maritalstatus:'M', Specialties:'Oncology', Degree:{DegreeTitle:'Doctor of Medicine',Degreefrom:'Maryland University',Date_of_Degree: new Date('Feb 22,1988')}, Certificate:{CertificateName:'Cardic Surgery', Date_of_Certificate: new Date('Sep 24, 1987')}, Department:['Laboratory and Blood Bank','Internal Diseases','Medical'], Mentor:'Sara Konei'} ) Embedded Document Embedded Document Embedded Document Embedded Document Array
  • 36. Insertdb.PATIENT.insert( { name:{firstname:'Ahmad', lastname:'Abdolahe', middelname:'Saeed'}, SSN:'33-90-1134', DOB: new Date('April 20,1995'), phone:{ HomePhone:'1-301-338-5986', CellPhone:'240-501-1968'}, Address: {street:'181 Ormand Street', city:'Frostburg', Zip:'21532', state:'Maryland'}, Maritalstatus:'M', Gender:'M', Race:'White', Smoker:'N', DrivingLicense:{ DRIVERSLICENSENUM: 72585432,DRIVERSLICENSESTATE:'MD'}, INFECTION_HISTORY: { DISEASE: 'Alopecia'}, MEDICINE_HISTORY:{ MEDICINE_USED:' Ripernol ', DOSAGE: '120 ml', START_DATE: new Date('JAN 18, 2000'), END_DATE: new Date('JUNE 03, 2001')}, ADMISSION:{ DEPARTMENT_NAME :[' Emergency ', 'Surgery'], ADMISSION_DATE: new Date ('Feb 14,1998'), DISCHARGE_DATE : new Date ('Feb 19,1998')}, ROOM_ASSIGNED:[145,289], BED: {TYPEOFBED: 'GeneralCare', Price:90 }, INSURANCE:{POLICYNUM:'12359867', COMPANYNAME: 'Royal sun', DATEISSUED: new Date ('JAN 14,2003'), EXPIRATIONDATE: new Date ('JAN 30,2004'),INSURANCETYPE: 'Private'}, Doctor_Info: [{Doctor_ID:db.DOCTOR.find()[0]._id},{Doctor_ID:db.DOCTOR.find()[1]. _id}]
  • 37. Update • db.collection.update() • db.DOCTOR.update({"Specialties" : " Anesthesia"},{$inc:{Salary:1000}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) db.PATIENT.update({"BED.Price":135},{$set:{"BED.Price":200}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 }) db.PATIENT.update({"name.firstname":"Nancy"},{$unset:{"INSURANCE":""}}) $set To increment the salary by 1000 $inc To update a field within an embedded document To increase the salaries of all doctors who are specialist in Anesthesia To delete a particular field $unset operator is used db.DOCTOR.update({"Maritalstatus" : "S"},{$set:{"Maritalstatus" : "M"}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
  • 38. Upsert The UPSERT command inserts documents that don’t exist and updates the documents that exist Insert Update
  • 39. Aggregation & Queries  MongoDB has a rich query framework  find() -The result from find is a cursor that can list the fields we want to retrieve.
  • 40. Aggregation & Queries  Find() : db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}) { "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } } { "name" : { "firstname" : "Simon", "lastname" : "Diohman" } } { "name" : { "firstname" : "Nancy", "lastname" : "Miller" } } { "name" : { "firstname" : "John", "lastname" : "Knusen" } }  Sort() 1 uses for ascending and -1 for descending { "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } } { "name" : { "firstname" : "John", "lastname" : "Knusen" } } { "name" : { "firstname" : "Nancy", "lastname" : "Miller" } } { "name" : { "firstname" : "Simon", "lastname" : "Diohman" } }  Skip()  Limit() db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1}).limit(1) { "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" } }  Count() db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1}) db.PATIENT.find({},{"name.firstname":1,"name.lastname":1,_id:0}).sort({"name.firstname":1}).skip(3) { "name" : { "firstname" : "Simon", "lastname" : "Diohman" } } db.PATIENT.count() 4 db.DOCTOR.count() 4
  • 41. Aggregation & Queries  Display information about the beds db.PATIENT.find({},{_id:0,BED:1})  Select the patient’s names that do not have insurance db.PATIENT.find( { INSURANCE: { $exists:false } }, {"name.firstname":1, "name.lastname":1, _id:0} )  Display the name of doctors who graduated between March 1, 2000 and March 1, 2010 >start= new Date("March/01/2000") ISODate("2000-02-29T23:00:00Z") > end= new Date("March/01/2010") ISODate("2010-02-28T23:00:00Z") db.DOCTOR.find({"Degree.Date_of_Degree":{"$gte":start,"$lt":end}},{_id:0,"name.firstname":1,"name.lastname":1, "Degree.Date_of_Degree":1}).pretty() new Date("<YYYY-mm-dd>") returns the specified date string ("<YYYY-mm-dd>") as a Date object. The Date is wrapped by ISODate helper.
  • 42. Aggregation Pipeline  Aggregation pipeline is a way to transform/combine documents in a collection. MongoDB Aggregation Operators SQL Terms, Function, and Concepts $match WHERE $group GROUP BY $match HAVING $project SELECT $lookup LEFT OUTER JOIN Db.collection.aggregate{$ Aggregation Operator :Field}
  • 43. Aggregation & Queries  Display doctors' name (three) sorted by Specialties (desc) db.DOCTOR.aggregate( [ { $project: {_id:0,Specialties:1,Name_Of_Doctor: {$concat:[ "$name.firstname", " " ,"$name.lastname"]}}},{$sort:{"Specialties": - 1}},{$limit:3}]) db.DOCTOR.find({},{"name.firstname":1,"firstname":1,"Specialties": 1,_id:0}).sort( { Specialties: 1 } ).limit(5) $concat? { "Specialties" : "Urology", "Name_Of_Doctor" : "Robert Orndorff" } { "Specialties" : "Oncology", "Name_Of_Doctor" : "John Thomsen" } { "Specialties" : " Anesthesia", "Name_Of_Doctor" : "Mary Donaldson" }
  • 44. Aggregation & Queries  Display the total price of beds for each patient db.PATIENT.aggregate( [ { $group: { _id:{$concat:[ "$name.firstname", "-" ,"$name.lastname"]},total: { $sum: "$BED.Price" } } } ] ) { "_id" : "Simon-Diohman", "total" : 200 } { "_id" : "John-Knusen", "total" : 135 } { "_id" : "Nancy-Miller", "total" : 0 } { "_id" : "Ahmad-Abdolahe", "total" : 90 }  Display the average doctor salaries by Maritalstatus db.DOCTOR.aggregate([{$group:{_id: "$Maritalstatus",Avg_Salary: { $avg: "$Salary" }}}]) { "_id" : "S", "Avg_Salary" : 200000 } { "_id" : "M", "Avg_Salary" : 264000 }
  • 45. Aggregation & Queries  Display patient names and the doctors name who has been visited  $lookup -New in version 3.2.  lookup() method uses to join between collections  Performs a left outer join to an unshared collection in the same database db.PATIENT.aggregate([ { $lookup: { from: "DOCTOR", localField: "_id", foreignField: "Doctor_ID", as: "test_look_up"}},{$project:{_id:0,"name.firstname":1,"name. Doctor_Info.Doctor_firstname":1, "Doctor_Info.Doctor_lastname":1}}]).pretty() Join
  • 46. Aggregation & Queries $lookup db.PATIENT.aggregate([ { $lookup: { from: "DOCTOR", localField: "_id", foreignField: "Doctor_ID", as: "test_look_up"}},{$project:{_id:0,"name.firstname":1,"nam e.lastname":1,"name. Doctor_Info.Doctor_firstname":1, "Doctor_Info.Doctor_lastname":1}}]) { "name" : { "firstname" : "Ahmad", "lastname" : "Abdolahe" }, "Doctor_Info" : [ { "Doctor_lastname" : "Orndorff" }, { "Doctor_lastname" : "Thomsen" } ] } { "name" : { "firstname" : "Simon", "lastname" : "Diohman" }, "Doctor_Info" : [ { "Doctor_lastname" : "Donaldson" }, { "Doctor_lastname" : "Thomsen" } ] } { "name" : { "firstname" : "Nancy", "lastname" : "Miller" }, "Doctor_Info" : { "Doctor_lastname" : "Donaldson" } } { "name" : { "firstname" : "John", "lastname" : "Knusen" }, "Doctor_Info" : { "Doctor_lastname" : " Mortensen" } }
  • 47. Aggregation & Queries db.DOCTOR.aggregate([{$match:{"name.firstname":"Robert"}},{$project:{Departm ent:1, _id:1, name:1}} ]).pretty() db.DOCTOR.aggregate([{$unwind:"$Department"},{$match:{"name.firstname":"Robert"}},{$project:{ Department:1, _id:1, name:1}} ]).pretty() $unwind -Deconstructs an array field from the input documents to output. A document for each element.
  • 48. Aggregation & Queries  mapReduce() is a data processing paradigm for condensing large volumes of data into useful aggregated results. MongoDB uses mapReduce command for map-reduce operations. MapReduce is generally used for processing large data sets. The map-reduce function: Query the collection Map a value with a key and emits a key-value pair Reduce all the documents having the same key end up in an array Out specifies the location of the map-reduce query result Query specifies the optional selection criteria for selecting documents Sort specifies the optional sort criteria Limit specifies the optional maximum number of documents to be returned Array
  • 49. Aggregation & Queries Display the total amount of salary for each single doctor. To Select single doctors To group them on the basis of SSN SUM the amount of salaries by each doctor db.DOCTOR.mapReduce( function() { emit(this.SSN,this.Salary); },function(SSN,Salary) {return Array.sum(Salary)}, {query:{Maritalstatus:"S"},out:"total_Salary_S"})
  • 50. MongoDB in Practice Personalization creates customized online experiences for the customers in real time based on analysis of behavioral and demographic profiles, historical interactions, and preferences.  Scratchpad automatically saves things you view while you shop across devices Scratchpad automates the Intelligently remembers searches hunts for the lowest prices makes it easy to shop across any device makes the travel search process fast, easy, and personalized  It keeps people from jumping to other travel sites. It dramatically increases conversion rates for Expedia. suppliers constantly change inventory and pricing information behind the scenes. create a huge volume of highly variable data. Scratchpad APP makes the travel search process fast, easy, and personalized
  • 51. MongoDB in Practice Scratchpad in Relational database Hotel Car
  • 52. MongoDB in PracticeMakes it possible for Expedia to create a feature that gives every user a relevant, seamless shopping experience. That collects highly- dynamic customer information in real-time and presents personalized offers on fly. Flexible document store and simple horizontal scale-out Makes it easy to store any combination of city pairs, dates and destinations. Expedia can even continue shopping for someone after that customer has closed out a session. When the customer returns, all the latest pricing and availability for their searches are displayed side by side on their Scratchpad. MongoDB’s flexible data model
  • 54. Graph Databases A Graph is a set of nodes and the relationships that connect those nodes  Nodes and Relationships contain properties to represent data. Properties are key-value pairs to represent data. Nodes can be labeled A graph database stores data in a graph Each node knows its adjacent nodes As the number of nodes increases, the cost of a local step (or hop) remains the same
  • 55. The best known examples of Graph Database
  • 56. RDBMS Vs Graph Database
  • 57. Why use a graph database?  Greater performance – compared to NoSQL stores or relational databases, graph databases offer much faster access to complex connected data, mainly as they lack expensive ‘join’ operations. In one example, a graph database was 1000x faster than a relational database when working with a query depth of four.  Lower latency – users of graph databases experience lower levels of latency. As the nodes and links ‘point’ to one another, millions of related records can be traversed per second and query response time remains constant irrespective of the overall database size.  Flexible and agile – a graph database should closely match the structure of the data it uses. This allows developers to start work sooner without the added complexity of mapping data across tables.  Good for semi-structured data – graph databases are schema free, meaning patchy data, or data with exceptional attributes, don’t pose a structural problem.
  • 58. Neo4j
  • 59. Neo4j Overview  Neo4j is world’s leading graph databases  Neo Technology is creator of Neo4j  Follows Property Graph Data Model  Is written in Java Language.  CQL(Cypher Query Language) as query language  An open source  Schema-free  Full ACID  High Availability  Supports highly connected data  It provides REST API to be accessed by any Programming Language like Java.
  • 60. Who is using Neo4j?
  • 61. Advantages of Neo4j  Easy to model and store relationships  CQL query language commands are very easy to learn.  It is very easy to represent connected data.  It is very easy and faster to retrieve/traversal/navigation data  It represents semi-structured data very easily.  Intuitiveness- In humane readable format  Speed  It uses simple and powerful data model.  Performance of relationship traversal remains constant with growth in data size  Fast agile development and evolution-It has a naturally adaptive model  Scalability-Neo4j scales up and out, supporting tens of billions of nodes and relationships, and hundreds of thousands of ACID transactions per second
  • 62. Property Value Types  Properties are named values where the name is a string.  Property values can be either a primitive or an array of one primitive type.For example String, int and int[] values are valid for properties NULL is not a valid property value NULL s can instead be modeled by the absence of a key
  • 63. Converting relational model into Graph model #1 Drop Foreign Keys #2 Join Tables become relationships #3 Attributes Properties AdmitTO VisitBY WorkIN Mentor
  • 64. Converting relational model into Graph model Department Doctor Patient WorkIN AdmitTO VisitBY Mentor
  • 65. Converting relational model into Graph model
  • 66. Create a node MATCH (p: Patient)where p.name= 'Simon Diohman' RETURN p CREATE (p:Patient{ name : 'Simon Diohman', SSN :'51-90-1134', CellPhone:'443-501- 1968',DOB:'1959-06-20' }) RETURN p
  • 68. Delete Delete all nodes and relationships Delete single node Delete a specific node Delete relationship Delete a node with all its relationships
  • 69. Remove  The REMOVE clause is used to remove properties and labels from graph elements.
  • 70. Update  The SET clause is used to update properties on nodes and relationships. Set a property-To set a property on a node or relationship Coping properties between nodes The Simon node has had all it’s properties replaced by the properties in the Simon node Update a relationship r r1
  • 73. Collection functions  Collection functions return collections of nodes, relationships and etc. in a path.  RELATIONSHIPS Returns all nodes in a path. Returns all relationships in a path.
  • 74. Neo4j in Practice Insurance Fraud  Insurance Fraud is the filing of a false claim to life, health, automobile, property, workers' compensation or other types of insurance benefits.  Insurance fraud is a significant and costly problem for both policyholders and insurance companies.  Insurance companies lose millions of dollars each year through fraudulent claims, largely because they do not have a way to easily determine which claims are legitimate and which may be fraudulent. Insurance companies shift the risk of loss to their customers
  • 75. Neo4j in Practice Typical Scenario  Rings of fraudsters work together to stage fake accidents.  Such rings normally include a number of roles.  Providers. Collusions typically involve participation from professionals in several categories: a. Doctors, who diagnose false injuries b. Lawyers, who file fraudulent claims, and c. Body shops, which misrepresent damage to cars 2.  Participants. These are the people involved in the (false) accident, and normally include: a. Drivers b. Passengers c. Pedestrians d. Witnesses
  • 76. Neo4j in Practice Simple 6-people collusion Simple Ten-Person Collusion 20000$x6x3+5000$x6=390000$ The ring can claim $390000 40000$*10*4+5000$x10=1.65M The ring can claim ?  Fraudsters often create and manage rings by “RECYCLING” participants so as to stage many accidents
  • 77. Neo4j in Practice To detect rings in the graph by walking the graph. In Real Time
  • 78. References  https://www.youtube.com/watch?v=A4gRg-9jNF4  http://www.aerospike.com/what-is-a-key-value-store/  A. P. D. P. Ameya Nayak, "Type of NOSQL Databases and its Comparison with Relational Databases  vol. International Journal of Applied Information Systems (IJAIS), no. ISSN : 2249- 0868, March 2013.  J. Kaur, "Distributed Hash Tables," 2014.  https://www.youtube.com/watch?v=i1KAvQ-pw08.  http://db-engines.com/en/ranking  https://redislabs.com  http://redis.io/  https://www.youtube.com/watch?v=A4gRg- 9jNF4&ebc=ANyPxKoFk4OYpr8O4v1Nf2ugf-  uEiStTzLxdMdyHf2KFxV5IuvDLA2wpMyAdsWbb9OP9H5KWwmK7wJuYe7d4cb8e3N YMuEDsRQ  http://www.tutorialspoint.com/redis/redis_quick_guide.htm  http://antirez.com/news/75  M. Paksula, "Persisting Objects in Redis Key-Value Database," University of Helsinki, Department of  Computer Science, Helsinki, Finland.  http://www.lynda.com/NoSQL-tutorials/Understanding-key-value- stores/368756/387726-4.html  http://data-magnum.com/9-lessons-for-starting-a-big-data-initiative-and-selecting-the- right-nosql-tools/
  • 79. References  K. Segun, &quot;The little MongoDB Book&quot;.  https://docs.mongodb.org/manual/core/data-modeling- introduction/.  https://docs.mongodb.org/manual/core/data-model- design/.  T. L. MongoDB.  https://docs.mongodb.org/manual/tutorial/query-documents/  https://www.mongodb.com/blog/post/joins-and- other-aggregation- enhancements- coming- in-  mongodb-3- 2-part- 1-of- 3-introduction  https://docs.mongodb.org/manual/reference/method/db.collection.save/  http://www.tutorialspoint.com/mongodb/mongodb_update_document.htm  https://docs.mongodb.org/manual/tutorial/query-documents/  http://www.tutorialspoint.com/cassandra/cassandra_cql_datatypes.htm  http://www.planetcassandra.org/try-cassandra/  https://dzone.com/refcardz/apache-cassandra  http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureDataDist ributeReplication_c.html  https://pdfs.semanticscholar.org/22c6/740341ef13d3c5ee52044a4fbaad911f7322.pdf  http://gettingstartedwithcassandra.blogspot.com/2011/06/cassandra-keyspaces-what- are-they.html  http://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_keyspace_r.html  http://docs.datastax.com/en/cql/3.1/cql/cql_reference/create_table_r.html
  • 80. References  http://www.slideshare.net/cjohannsen/apache-cassandra-at-the-geek2geek-berlin  http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureIntro_c.ht ml  http://www.slideshare.net/planetcassandra/configuring-an-apache-cassandra-node  http://distributeddatastore.blogspot.com/2015/08/cassandra-replication.html  http://learn.exponential.io/courses/cassandra-consistency/lectures/98884  http://docs.datastax.com/en/cassandra/2.0/cassandra/architecture/architectureIntro_c.ht ml  http://www.slideshare.net/VaradMeru/cassandra-a-decentralized-structured-storage- system  https://grockdoc.com/cassandra/2.1/articles/consistency_bdd0c698-463d-4bdb-b6f7- 8118f601ba09  https://www.cs.cornell.edu/projects/ladis2009/papers/lakshman-ladis2009.pdf  http://learn.exponential.io/courses/cassandra-consistency/lectures/98884  https://www.youtube.com/watch?v=-zyZ35YyT_8  http://www.planetcassandra.org/blog/case-study-netflix/  http://www.datastax.com/wp-content/uploads/2011/09/CS-Netflix.pdf  http://www.3pillarglobal.com/insights/selection-criteria-for-nosql-database  http://neo4j.com/blog/nosql-scaling-to-size-and-scaling-to-complexity/  https://www.digitalocean.com/community/tutorials/a-comparison-of-nosql-database- management-systems-and-models  http://cambridge-intelligence.com/keylines/graph-databases-data-visualization/
  • 81. References  https://redislabs.com/ebook/redis-in-action/part-1-getting-started/chapter-1-getting-to- know-redis/1-2-what-redis-data-structures-look-like/1-2-4-hashes-in- redis#sthash.eacmDHF3.dpuf  http://oldblog.antirez.com/post/take-advantage-of-redis-adding-it-to-your-stack.html  http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in- redis.html  Http://www.tutorialspoint.com/neo4j/neo4j_overview.htm  http://www.slideshare.net/neo4j  http://neo4j.com/docs/stable/graphdb-neo4j.html  http://www.slideshare.net/maxdemarzi/introduction-to-graph-databases-12735789  http://www.slideshare.net/andres_taylor/graph-database-super-star- 8079303?qid=2cc5495e-f25a-4d99-be76-ab2ab9f6e72a&v=&b=&from_search=2  https://www.pythian.com/blog/when-is-mongodb-the-right-choice-for-your-business-we- explore-detailed-use-cases-2/  Http://www.slideshare.net/mongodb/expedia-36715535  http://www.slideshare.net/gschmutz/nosql-databases-for-implementing-data-services- should-i-care  http://www.datastax.com/wp-content/uploads/2011/09/CS-Netflix.pdf  https://www.mongodb.com/document-databases  http://www2.mta.ac.il/~kirsh/download/MTA%20NoSQL%20Seminar/Lectures/MongoD B.pdf  http://info.neo4j.com/rs/neotechnology/images/Fraud%20Detection%20Using%20Grap hDB%20-%202014.pdf  https://www.youtube.com/watch?v=hKLKpqY9UrY  http://data-magnum.com/9-lessons-for-starting-a-big-data-initiative-and-selecting-the-