What is MongoDB?

In this Tutorial, we will learn What is MongoDB, As it is a database management system that deals which documents, Collections, and fields to store the data in a non-structural way where the structure is not a priority. Whichid developed by MongoDB inc.

MongoDB

MongoDB

MongoDB was founded by three friends Dwight Merriman,  Eliot Horowitz, and Kevin RyanIt is an Open source which is a document- oriented database management system which is called NoSQL which used JSON (JavaScript Object Notations) to store the data where we specify the structure of data stored in specified at the time of storing the data.

Here the structure of data depends on the types of data that is stored in the documents which also decides the complexity of the stored data. Here data related to one nothing is stored in one place without any structured manner as it was stored in MYSQL so it provides flexibility to store and edit the data when needed.

To create a collection and get started with MongoDB just follow the code given below.

var mydoc = {
               _id: ObjectId(" 50998 03df3f4948b d2f98391"),
               name: { first: "James", last: "Joyce" },
               birth: new Date('Feb 02, 1882'),
               death: new Date('Jan 14, 1941'),
               books: [ "Ulysses", "Dubliners", "Finnegan's Wake" ],
               sales : NumberLong (1250000)
            }

Here we created a document of name Mydoc where my doc is the name of the document which we just created to store our data where id holds the object id, Name comprises of first and last name, Birth and death hold the date, books which store the data in the string whereas sales in number.

which shows different data types which can be stored in the document MongoDB. And data is stored in same way shown in the example above.

There are times when we need to store the data in unstructured ways like when we do not know the number of columns the data could hold like in the first record we have to enter the data in 4 columns and in the next record we need 5 columns to enter the data.

In such case, we can not us SQL as the number of columns in SQL are fixed during the creation of the table and we can not alter them in any case, if we enter the data beyond it will show an error and could enter the data.

For the same either we have to add a new column or drop that data and if add a new column it will be much more costly as it increases the size of the table.

So we required instructed data storage and for the same, we have introduced MongoDB where we can enter the data as per our choice and the number of columns could warry at any point in time.

 

 

To learn more about MongoDB Visit Getting started with MongoDB And learn more about MongoDB.

To Learn More MongoDB MongoDB Tutorials And Problems To learn more about different programming languages and solutions to different problems related to programming languages and learn the different concepts of Java And Python visit beta python for programming Solutions. 

Leave a Comment

%d bloggers like this: