NoSQL Mongodb
NoSQL Mongodb
NoSQL:
n A fast, portable, open-source RDBMS
n A derivative of the RDB database system
n Based on the “operator/stream paradigm”
2
NoSQL
• NoSQL is a non-relational database management systems, different from traditional relational database
management systems in some significant ways.
• It is designed for distributed data stores where very large scale of data storing needs (for example
Google or Facebook which collects terabits of data every day for their users).
• These type of data storing may not require fixed schema, avoid join operations and typically scale
horizontally.
RDBMS NoSQL
- Structured and organized data - Stands for Not Only SQL
- Structured query language (SQL) - No declarative query language
- Data and its relationships are stored in - No predefined schema
separate tables. - Key-Value pair storage, Column Store,
- Data Manipulation Language, Data Document Store, Graph databases
Definition Language - Eventual consistency rather ACID property
- Tight Consistency - Unstructured and unpredictable data
- Prioritizes high performance, high availability
and scalability
NoSQL Examples
4
Primary NoSQL Categories
5
Key/Value Store DynamoDB
Azure Table Storage
Riak
Rdis
Aerospike
FoundationDB
LevelDB
Berkeley DB
The basic data model: Oracle NoSQL Database
GenieDb
BangDB
Database is a collection of key/value pairs Chordless
Scalaris
Tokyo Cabinet/Tyrant
The key for each pair is unique Scalien
Voldemort
No requirement for normalization Dynomite
(and consequently dependency KAI
MemcacheDB
preservation or lossless join)
Primary operations: Faircom C-Tree
LSM
KitaroDB
insert(key,value) HamsterDB
STSdb
delete(key) TarantoolBox
Maxtable
Quasardb
update(key,value) Pincaster
RaptorDB
TIBCO Active Spaces
lookup(key) Allegro-C
nessDB
HyperDex
SharedHashFile
Symas LMDB
Additional operations: Sophia
PickleDB
Mnesia
variations on the above, e.g., reverse lookup LightCloud
Hibari
OpenLDAP
iterators Genomu
BinaryRage
Elliptics
Dbreeze
RocksDB
TreodeDB
(www.nosql-database.org
www.db-engines.com
www.wikipedia.com)
6
Wide Column Store
Flexible schema - the set of columns is not fixed, and may differ from row-to-row
BigTable
Cassandra
Cloudata
Cloudera
Druid
Flink
One last column detail: Hbase
Hortonworks
HPCC
Column key consists of two parts – a column family, and a qualifier Hyupertable
KAI
KDI
MapR
MonetDB
OpenNeptune
Qbase
Splice Machine
Sqrrl
(www.nosql-database.org
www.db-engines.com
www.wikipedia.com)
7
Wide Column Store
Column families
Row key
Column qualifiers
8
Wide Column Store
Medical data
One “table”
9
Wide Column Store
Row key
t1
t0
One “row”
10
Graph Store
AllegroGraph
ArangoDB
Bigdata
The basic data model: Bitsy
BrightstarDB
Directed graphs DEX/Sparksee
Execom IOG
Fallen *
Nodes & edges, with properties, i.e., “labels” Filament
FlockDB
GraphBase
Graphd
Horton
HyperGraphDB
IBM System G Native Store
InfiniteGraph
InfoGrid
jCoreDB Graph
MapGraph
Meronymy
Neo4j
Orly
OpenLink virtuoso
Oracle Spatial and Graph
Oracle NoSQL Datbase
OrientDB
OQGraph
Ontotext OWLIM
R2DF
ROIS
Sones GraphDB
SPARQLCity
Sqrrl Enterprise
Stardog
Teradata Aster
Titan
Trinity
TripleBit
VelocityGraph
VertexDB
WhiteDB
(www.nosql-database.org
www.db-engines.com
www.wikipedia.com)
11
Document Store
AmisaDB
The basic data model: ArangoDB
BaseX
The general notion of a document – words, phrases, sentences, paragraphs, sections, Cassandra
Cloudant
Clusterpoint
subsections, footnotes, etc. Couchbase
CouchDB
Densodb
Flexible schema – subcomponent structure may be nested, and vary from Djondb
EJDB
document-to-document.
Elasticsearch
eXist
FleetDB
Metadata – title, author, date, embedded tags, etc. iBoxDB
Inquire
JasDB
Key/identifier. MarkLogic
MongoDB
MUMPS
NeDB
NoSQL embedded db
12
MongoDB
• A record in MongoDB is a document, which is a data structure composed of field and value
pairs.
• MongoDB documents are similar to JSON objects.
• The values of fields may include other documents, arrays, and arrays of documents.
13
Installing MongoDB
Go to:
www.mongo
db.com
Then go to
software ->
Community
Server
Then Click
Download
14
Installing Steps
1. Copy the path 2. Click environment variables 3. System variable 4. Add path 5. Add the
address (upto bin) 6. save this
2. A) Now go to C folder B) Create ‘data’ folder C) within data create ‘db’ folder
15
Run Command promt
16
Commands
Create collection
Here collection represents table For delete database use
>db.dropDatabase()
>db.createCollection(“table_name”)
Show the databases again
>db.createCollection(“testable”)
“another” database is
deleted
17
Commands
Go to the database
See all the collection
Presents using
>show collections
For delete
>db.collection_name.drop()
Db.tablename.insertMany([{ }, { }, { }])
18
Commands
Retrieve data
>db.table_name.find();
19
Commands
Delete row
>db.table_name.deleteMany({attribute:value})
Different types of
update options available
20
MapReduce Example
Source: https://docs.mongodb.com/manual/aggregation/
21
MapReduce Example
Create a database
Create collection “cust”
Use aggregate function. Take the data of “A” and sum the amount based on “id”
22
Reference
http://www.strozzi.it/cgi-bin/CSA/tw7/I/en_US/nosql/Home%20Page
Manual: https://docs.mongodb.com/manual