วันจันทร์ที่ 16 มกราคม พ.ศ. 2560

MongoDB VS. Cassandra

Data in MongoDB is stored in BSON documents – JSON-style data structures. Documents contain one or more fields, and each field contains a value of a specific data type, including arrays, binary data and sub-documents. Documents that tend to share a similar structure are organized as collections.
It may be helpful to think of documents as analogous to rows in a relational database, fields as similar to columns, and collections as similar to tables.
Reference: https://www.mongodb.com/faq?jmp=footer
Document Structure
The key decision in designing data models for MongoDB applications revolves around the structure of documents and how the application represents relationships between data. There are two tools that allow applications to represent these relationships: references and embedded documents.
References
Data model using references to link documents. Both the ``contact`` document and the ``access`` document contain a reference to the ``user`` document.
ส่วนตัวแล้วพบว่า1documentก็คือ1recordของตารางที่normalizedแล้ว

Embedded Data

Data model with embedded fields that contain all related information.


Source: https://docs.mongodb.com/manual/core/data-modeling-introduction/


MongoDB can store binary file smaller than 10 MB directly in a document file, otherwise consider using GridFS to store binary files in separate files from the document file.


MongoDB VS. Cassandra