2. 2
JSON
JSON – JavaScript Object Notation
All you need to know first is Object and Array.
Use Unicode to replace special symbols.
3. 3
MongoDB
MongoDB (from humongous) is a cross-platform document-oriented database
• Document-oriented
• Ad hoc queries
• Indexing
• Replication
• Load balancing
• File storage
• Aggregation
• Server-side JavaScript execution
• Capped collections
4. 4
MongoDB
• SQL v.s. MongoDB naming
SQL MongoDB
database database
table collection
row document
column field
index index
primary key primary key
table joins N/A
view N/A
5. 5
MongoDB
• Create your MongoDB
– Register MongoLab (Free 500 MB storage) and create DB / Account
• https://mongolab.com/
– Install MongoDB GUI tool
• 3T MongoChef
• Robomongo (0.8.x not full support MongoDB 3.0)
6. 6
Replication Set
• Replication provides redundancy and increases data availability. With
multiple copies of data on different database servers, replication protects a
database from the loss of a single server.
• When to Voite?
– Initiation
– Primary disconnect with other Secondary
B
A
….Heartbeat
Voting
B
Replication
A
….
Primary
Secondary Secondary
8. 8
Shard
• Shard, or horizontal scaling, by contrast, divides the data set and distributes
the data over multiple servers, or shards. Each shard is an independent
database, and collectively, the shards make up a single logical database.
9. 9
Shard
• Deploy a Shard Cluster
• Increase a Shard
• Remove a Shard
Router
(mongos)
Shard1
(mongod)
Shard2
(mongod)
Config Server
(mongod)
Shard3
(mongod)
10. 10
Reference
• No SQL list
– http://nosql-database.org/
• MongoDB
– http://www.cnblogs.com/zhy4606/category/322458.html
– http://blog.csdn.net/Crazy__Programmer/article/category/1711961
• MongoDB的寫入安全機制
– http://blog.chinaunix.net/uid-15795819-id-3373361.html
• No SQL 演算法
– https://goo.gl/FDG7fT
– http://my.oschina.net/juliashine/blog/88173
• 使用WEP API 與 Mongodb連結
– http://goo.gl/WCz6sc