
Indexing is also supported which means documents can be retrieved quickly.Įasy horizontal scaling : Most SQL databases allow only vertical scaling which is also commonly called scaling up. The MongoDB Query Language (MQL) is a full-featured, powerful language that allows you to query deep into documents, and even use the aggregation framework to perform complex analytics with just a few lines.


Data is very easy to query and you rarely need joins or transactions. When querying data, you have a wide range of options, operators, expressions and filters. Every document we save in Mongo can be as flat and simple or as complex as our application requires.įeature rich query language : MongoDB Query Language (MQL) is based on JavaScript and very easy to learn. So the point is, document schema in Mongo is dynamic and self-describing. In the first document we have graduated boolean field, whereas in the second document instead of graduated we have a string gender field. In the following example, we have 2 documents with student data.īoth the documents have id and name fields.
#NON TABULAR DATABASE CODE#
Our application code will be much cleaner, simpler and easier to maintain.įlexible schema : JSON documents that actually store data have a flexible schema which means it is perfectly okay and normal for 2 documents to have different fields. No complex joins and mapping layers are required. For an application this data is very easy to work with. The data that we typically store across many many relational database tables can be stored in a single collection. Benefits of a document databaseĮasy to use data model : In a document database like MongoDB we do not have tables and rows, instead we have collections and documents. It is easy to create relationships between data entities and quickly query these relationships, for example you can find out who the "friends of friends" of a particular person are. Heavily used in fraud detection and social networking. There is no limit to the kind and number of relationships. Graph database - It is used to store and navigate relationships. Wide-Column store - It is similar to a relational database in the sense it stores data in rows and columns, however the columns are dynamic and each row does not have to have the same columns. non-relational databases have been designed from the groundup for the cloud, which makes them naturally good for horizontal scaling where lots of smaller servers can be spun up to handle increased load. If you want a flexible schema for the data i.e in terms of shape or size, or if it needs to be open to change in the future, then a non-relational database is the answer. In a non-relational database documents are embedded within documents, which helps keep data that will be accessed together in the same place, but if this isn’t right for your needs, use a relational database, for example, if you have a large dataset with complex structure and relationships, embedding might not create clear enough relationships.įinally, relational databases have been around for a very very very long time which means there is wide support available, from tools to integration with data from other systems. Normalization in a relational database reduces the size of the data on disk by limiting duplicate data and anomalies. Also, if relationships between entities are important, again relational databases are the best choice. Well, relational databases are still the best choice if the data is predictable, in terms of structure, size, and frequency of access. When to use SQL database over non-relational database Value can be a string, number, boolean, or an array.A key/value pair consists of a field name (in double quotes), followed by a colon, followed by a value.Data in a JSON document is stored in key/value pairs.
#NON TABULAR DATABASE SOFTWARE#
This is the reason it became a very popular format for storing and exchanging data between software systems. JSON format is text-based and both humans and machines can very easily read it. In the following JSON document we have student data. What is JSON : The acronym JSON stands for JavaScript Object Notation. BSON is Binary JSON, so first let's understand, what is JSON? So data in MongoDB is stored in BSON documents. In MongoDB we do not have tables, instead we have documents. In a relational database like SQL server data is stored in a table, obviously in rows and columns. At the end of the day, MongoDB is a database and we use it to store data. It's important to understand the difference between JSON and BSON.

Difference between JSON and BSON in MongoDB
