0.Intro to MongoDB

What is MongoDB ? 

  • Non-relational data store for JSON documents.


Non-relational ?

It doesn't store its data in tables.
                                -> This is for relational database.

JSON

  • JavaScript Object Notation.
  • This is wrapped with curly bracket { } and consists of "key and value"
    ex) { "name" : "Andrew" }
        -> key      -> value

  • JSON has a hierarchy
    ex) {a:6,b:8,fruit:["apple","pear","banana"]}

  • There are only two basic data structures inside JSON. They are arrays and dictionaries. (They can be combined in arbitrary ways.)




What are MongoDB features ?

(1) MongoDB stores documents !
 This makes it so easy to program in.
 (Document-oriented data store is more useful to programming than relational-database)

(2) MongoDB is schemaless !
 Two documents don't need to have the same schema.

ex) 
In collection 'A'

document 1 {a:3,b:7} 
document 2 {a:7,b:9,c:10} 

Different schema!
However It is available in MongoDB.

(3) a MongoDB document can't be more than 16MB.




What MongoDB can't do.

(1) Join
MongoDB does not support "join"
if you wanted to do a join between two collections, you can't do it.
The reason is "join" is one of the items that scales particularly poorly.

(2) transactions
MongoDB does not support "transaction"
However, you often don't need transactions in MongoDB.
The reason is that in MongoDB, the documents are hierarchical. 
you can access those documents atomically.

댓글 없음:

댓글 쓰기