Document Database

16
Distributed Database Document Database

description

Describe NoSQL database and focused on document database

Transcript of Document Database

Page 1: Document Database

Distributed Database Document Database

Page 2: Document Database

What’s Document

• Documents are the main concept in document databases.

• A document in a document database is simply an entity that contains a collection of named fields

• It can be :• XML• JSON• BSON• And so on ..

Page 3: Document Database

Designing Document Database

• Modeling Data as Documents• JSON, BSON, XML …

• Denormalizing Documents and Embedding Data• Normalizing Documents and Referencing Data• Handling Complex Relation• Retrieving Data and Indexing Documents• Summarizing Data by Using Materialized Views

Page 4: Document Database

Materialized Views

Page 5: Document Database

Oracle vs MongoDB

Page 6: Document Database

Features

• Consistency• Replica Set

• Transaction• Availability • Query • Scaling

Page 7: Document Database

Replica Set

Page 8: Document Database

Suitable Use Case

• Event Logging• Content Management Systems, Blogging Platforms

• Web Analytics or Real-Time Analytics• E-Commerce Applications

Page 9: Document Database

When Not to Use

• Complex Transactions Spanning Different Operations

• Queries against Varying Aggregate Structure

Page 10: Document Database

Sample Document• {  "firstname": "Pramod",  "citiesvisited": [ "Chicago", "London", "Pune", "Bangalore" ],  "addresses": [    { "state": "AK",      "city": "DILLINGHAM",      "type": "R"    },    { "state": "MH",      "city": "PUNE",      "type": "R" }  ],  "lastcity": "Chicago"}

Page 11: Document Database

Popular Document Database• MongoDB• CouchDB• Terrastore• OrientDB• RavenDB

Page 12: Document Database

Sample Case – Product Catalog

Page 13: Document Database

Sample Case – Order History

Page 14: Document Database

Sample Architecture

Page 15: Document Database

MongoDB

Page 16: Document Database

MongoDB Tools• mongo, mongod• mongoimport, mongoexport

• Export and import data as JSON or CSV

• mongodump, mongorestore, bsondump• Create and restore binary export

• mongostat• Overviewing the status of the MongoDB server