01 - Mongodb - Intro
01 - Mongodb - Intro
What is MongoDB?
In 2009, the company shifted to an open source development model, with the company offering
commercial support and other services. In 2013, 10gen changed its name to MongoDB Inc.
4
What is MongoDB?
5
http://db-engines.com/en/ranking
What is MongoDB?
Instead of storing data in rows and columns as one would with a relational database, MongoDB
uses a document data model and stores a binary format of JSON documents called BSON.
Documents contain one or more fields, and each field contains a value of specific data type,
including arrays and binary data. Documents are stored in collections, and collections are
stored in databases.
There is no fixed schemas in MongoDB, so documents can vary in structure and can be
adapted dynamically.
6
What is MongoDB?
RDBMS MongoDB
Database Database
Table Collection
Index Index
Row Document
Column Field
7
What is MongoDB?
8
What is MongoDB?
9
What is MongoDB?
10
What is MongoDB?
11
What is MongoDB?
12
What is MongoDB?
13
What is MongoDB?
14
What is MongoDB?
{
_id: “123”,
title: "MongoDB: The Definitive Guide",
authors: [
{ _id: "kchodorow", name: "Kristina Chodorow“ },
{ _id: "mdirold", name: “Mike Dirolf“ }
],
published_date: ISODate(”2010-09-24”),
pages: 216,
language: "English",
publisher: {
name: "O’Reilly Media",
founded: 1980,
locations: ["CA”, ”NY” ]
}
}
15
What is MongoDB?
16
What is MongoDB?
https://docs.mongodb.com/
17
What is MongoDB?
MongoDB uses JSON (or rather, BSON, but we’ll get to that) to deal with structured
documents.
18
What is MongoDB?
19
What is MongoDB?
20
What is MongoDB?
21
What is MongoDB?
22
What is MongoDB?
23
What is MongoDB?
ObjectId
ObjectId is a special 12 byte value
Guaranteed to be unique across your cluster
24