Академический Документы
Профессиональный Документы
Культура Документы
Introduction to MongoDB
MongoDB
NoSQL
NoSQL is a new way of designing Internet-scale database solutions.
It is not a product or technology but a term that defines a set of database technologies
that are not based on the traditional RDBMS principles.
SQL
The idea of RDBMS was borne from E.F. Codds 1970 whitepaper titled A relational
model of data for large data
The language used to query RDBMS systems is SQL (Sequel Query Language ).
RDBMS systems are well suited for structured data held in columns and rows,
The RDBMS systems are based on the concept of ACID transactions. ACID stands for
Atomic, Consistent, Isolated, and Durable, where
MongoDB
Advantages of NoSQL
High scalability NoSql databases are expand horizontally using low-end
commodity servers
Manageability and administration : NoSQL databases are designed to mostly
work with automated repairs, distributed data, and simpler data models, leading to
low manageability and administration
Low cost : NoSQL databases are typically designed to work with a cluster of
cheap commodity servers, enabling the users to store and process more data at a
low cost.
Flexible data models : NoSQL databases have a very flexible data model,
enabling them to work with any type of data;
MongoDB
Disadvantages of NoSQL
Maturity : Most NoSQL databases are pre-production
versions with key features that are still to be implemented
Support : Support is one limitation that you need to
consider. support is very minimal as compared to the
enterprise software companies
Limited Query Capabilities : Since NoSQL databases are
generally developed to meet the scaling requirement of
the web-scale applications, they provide limited querying
capabilities
Expertise : Since NoSQL is an evolving area, expertise on
the technology is limited in the developer and
administrator community
MongoDB
MongoDB
NoSQL Category
MongoDB
Feature Comparison
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB stores its information in documents rather than rows.
{
_id: 10,
username: 'peter',
email: 'pbbakkum@gmail.com'
}
Consider the case where youd
like to store multiple emails for each user. In the relational world, you might create
a separate table of email addresses and the users to which theyre associated
{
_id: 10,
username: 'peter',
email: [
'pbbakkum@gmail.com', 'pbb7c@virginia.edu'
]
}
MongoDB
MongoDB
MongoDBs document format is based on JSON, a popular scheme for storing
arbitrary
data structures JSON structures consist of keys and values,
MongoDB
Advantages of MongoDB over RDBMS
Schema less : MongoDB is document database in which one collection holds
different different documents. Number of fields, content and size of the
document can be differ from one document to another.
Structure of a single object is clear
No complex joins
Deep query-ability. MongoDB supports dynamic queries on documents using a
document-based query language that's nearly as powerful as SQL
Tuning
Ease of scale-out: MongoDB is easy to scale
Conversion / mapping of application objects to database objects not needed
Uses internal memory for storing the (windowed) working set, enabling faster
access of data
MongoDB
MongoDB
MongoDB
MongoDB
Examples
Suppose a client needs a database design for his blog website and see the
differences between RDBMS and MongoDB schema design. Website has the
following requirements.
Every post has the unique title, description and url.
Every post can have one or more tags.
Every post has the name of its publisher and total number of likes.
Every Post have comments given by users along with their name, message, datatime and likes.
On each post there can be zero or more comments.
In RDBMS schema design for above requirements will have minimum three tables
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB
MongoDB
> db.users.find()
> db.users.find({username: "jones"})
> db.users.find({
... _id: ObjectId("552e458158cd52bcb257c324"),
... Username
: "smith"
... })
> db.users.find({ $and: [
... { _id: ObjectId("552e458158cd52bcb257c324") },
... { username: "smith" }
... ] })
> db.users.find({ $or: [
... { username: "smith" },
... { username: "jones" }
... ]})
MongoDB
MongoDB
MongoDB