Consider following example document stored in MongoDB
This image shows document representing interests of the person named Smith. As you can see this is set of properties and their values which can be described in simple data structures like strings and numbers. As shown by 2, values can be another JSON document, or they can be arrays of values shown by property 3. There is _id filed pointed by 1 which is present in each document in MongoDB. This field acts as a primary key the in the database. We will learn more about -id filed in future articles.
MongoDB documents do not need to have a fixed structure. Lack of an enforced schema is beneficial when we need to add a new field on the go. Consider that we need to add an email field to above structure. We can do that quickly by adding “email”: “value” pair to document. We do not need to change existing documents in this case.
MongoDB also provides replication. We can horizontally scale MongoDB very easily. It also provides secondary indexes. We can add up to 64 indexes to each document. All these features made MongoDB very popular.
In next few articles, We will explore the features of MongoDB along with how to query on the database and integrate MongoDB using Java and python. Till then happy learning :).
I am passionate about data analytics, machine learning, and artificial intelligence. Recently I have started blogging about my experience while learning these exciting technologies.