Before switching from a RDMS such as Oracle or SQL Server to MongoDB, one should be familiar with some key concepts of the NoSQL DataBase.
Before starting, we have should translate some traditional concepts of the RDMS world :
- A collection is like a table
- A document is a like a row
- Afield is a like a column
That said we can take a look at the key concepts of MongoDB.
The fields of a document can be changed at anytime. Documents of a collection may have different fields or even different data types for the same field.
Atomicity of write operations
Write operations are atomic for one single document. A document will never be partially update, even if the document contains multiple sub-documents. On the contrary write operations on multiple documents are never atomic.
Unique index allows to have uniqueness. For example, we can create a unique index on the field person_id on the persons collection.
Readers can see the result of writes before the writes are said to be durable. A durable write is a write that persists after a shutdown or restart of one or more servers.
The same data set can be replicated in order to provide high availability (for read performance) or redundancy (for data security).
A collection can be partitioned among multiple server in order to offer horizontal scaling. Data is partitioning is based on a key called the shard key.
MongoDB is easy to start with but can be difficult to master. Those are the key concepts to know before diving more into the understanding of the NoSQL database.