2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								title: MongoDB
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								---
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 06:02:12 +07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< img  src = "https://upload.wikimedia.org/wikipedia/en/thumb/4/45/MongoDB-Logo.svg/527px-MongoDB-Logo.svg.png" >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								## MongoDB
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-07 21:01:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MongoDB is an open-source non-relational database that uses a JSON-like structure to store data. 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								It uses a document model to store and retrieve the data instead of the table model used by relational databases such as SQL or Oracle.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-14 21:56:38 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use.
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 04:36:10 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								MongoDB in applications built with javascript is mainly used with Mongoose which is a package built on top of native mongo driver . It gives features like schema based design , virtuals , data validations etc. It makes the mongodb experience smooth and easy to use. You can learn more about mongoose [here ](https://mongoosejs.com/ ).
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-07 21:01:57 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### NoSQL Vs RDBMS
  
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| MongoDB Terms And Concepts | SQL Terms and Concepts |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| --- | --- |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Database | Database |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Collection | Table |
							 
						 
					
						
							
								
									
										
										
										
											2019-03-07 18:22:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								| Document | Row |
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								| Field | Column |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Index | Index |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								| Embedded Documents | Table Joins |
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### MongoDB Characteristics
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Next Generation Database 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  No Joins 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  Clustering 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								4.  Opensource 
						 
					
						
							
								
									
										
										
										
											2019-03-07 18:22:45 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								5.  Schema-Less 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								6.  No Relationships 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								### Features of MongoDB
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Document Database 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  High Performance 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  Rich Query Language 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								4.  High Availability 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								5.  Horizontal Scalability 
						 
					
						
							
								
									
										
										
										
											2019-03-08 05:12:08 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								6.  Supports Indexing 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 05:12:08 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Cons of MongoDB
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								1.  Schemaless design requires database manager to ensure certain constraints 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								2.  Indexing on multiple fields takes more memory 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								3.  Aggregation queries are at times non-intutive 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 07:31:18 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								### Sample Document Structure
  
						 
					
						
							
								
									
										
										
										
											2019-04-16 09:06:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 07:31:18 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   "_id":ObjectId("52ffc33cd85242f436123532"),
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   "name": "Rich Rick",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   "contact": "8826078979",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   "dob": "11-04-1997",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   "address": [
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "building": "24 A, Indiana Apt",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "pincode": 123456,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "city": "Los Angeles",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "state": "California"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      },
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      {
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "building": "170 A, Acropolis Apt",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "pincode": 456899,
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "city": "Chicago",
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         "state": "Illinois"
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      }
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   ]
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}
							 
						 
					
						
							
								
									
										
										
										
											2019-04-16 09:06:40 -07:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								```
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 07:31:18 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 14:47:55 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								### More Information
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[What is Mongo DB? ](https://www.mongodb.com/what-is-mongodb )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[Wikipedia article on Document-oriented Databases ](https://en.wikipedia.org/wiki/Document-oriented_database )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[SQL vs NoSQL ](https://insights.dice.com/2012/07/16/sql-vs-nosql-which-is-better/ )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[Learn MongoDB from MongoDB ](https://university.mongodb.com/ )
							 
						 
					
						
							
								
									
										
										
										
											2018-11-17 13:24:45 +03:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-03-08 05:12:08 +05:30 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								[ACID vs BASE databases ](http://www.dataversity.net/acid-vs-base-the-shifting-ph-of-database-transaction-processing/ )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								[Getting Started with MongoDB ](https://docs.mongodb.com/manual/tutorial/getting-started/ )