What is it :

MongoDB is a cross-platform document-oriented database. It’s a non-relational database in which data is store in JSON documents. Data not stored in tables but it stored in JSON documents.

JSON : –

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write.t is based on a subset of the JavaScript Programming Language. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.
Example :-

{
“Name” :  “Deepak”,
“Age”     :   “21”,
“City”    :   “Malerkotla”
}

MongoDB Schemaless :

MongoDB is a JSON-style data store.  The documents stored in the database can have varying sets of fields, with different types for each field.  One could have the following objects in a single collection:

{ name : “Joe”, x : 3.3, y : [1,2,3] }
{ name : “Kate”, x : “abc” }
{ q : 456 }

Of course, when using the database for real problems, the data does have a fairly consistent structure.  Something like the following would be more common:

{ name : “Joe”, age : 30, interests : ‘football’ }
{ name : “Kate”, age : 25 }

Advertisements