Uploaded on Jun 24, 2021
PPT on Understanding MongoDB Database.
Understanding MongoDB Database.
UNDERSTANDING MONGODB DATABASE WHAT IS MONGODB? • MongoDB is a document-oriented NoSQL database used for high volume data storage. • Instead of using tables and rows as in the traditional relational databases, MongoDB makes use of collections and documents. Source: www.guru99.com MONGODB FEATURES • Each database contains collections which in turn contains documents. The size and content of each document can be different from each other. • The document structure is more in line with how developers construct their classes and objects in their respective programming languages. Source: www.guru99.com MONGODB FEATURES CONT. • The rows doesn't need to have a schema defined beforehand. Instead, the fields can be created on the fly. • The data model available within MongoDB allows you to represent hierarchical relationships, to store arrays, and other more complex structures more easily. Source: www.guru99.com KEY COMPONENTS OF MONGODB ARCHITECTURE • _id – The _id field represents a unique value in the MongoDB document. The _id field is like the document's primary key. • Collection – This is a grouping of MongoDB documents. • Cursor – This is a pointer to the result set of a query. Clients can iterate through a cursor to retrieve results. Source: www.guru99.com KEY COMPONENTS OF MONGODB ARCHITECTURE CONT. • Database – This is a container for collections like in RDMS wherein it is a container for tables. • Document - A record in a MongoDB collection is basically called a document. The document, in turn, will consist of field name and values. • Field - A name-value pair in a document. A document has zero or more fields. Fields are analogous to columns in relational databases. Source: www.guru99.com WHY USE MONGODB? • Document-oriented – Since MongoDB is a NoSQL type database, instead of having data in a relational type format, it stores the data in documents. • Ad hoc queries - MongoDB supports searching by field, range queries, and regular expression searches. • Indexing - Indexes can be created to improve the performance of searches within MongoDB. Source: www.guru99.com WHY USE MONGODB CONT. • Replication - MongoDB can provide high availability with replica sets. A replica set consists of two or more mongo DB instances. • Load balancing - MongoDB uses the concept of shading to scale horizontally by splitting data across multiple MongoDB instances. Source: www.guru99.com DATA MODELLING IN MONGODB • MongoDB's collections do not enforce document structure. • This sort of flexibility is what makes MongoDB so powerful. Source: www.guru99.com NEEDS OF THE APPLICATION • Look at the business needs of the application and see what data and the type of data needed for the application. • Based on this, ensure that the structure of the document is decided accordingly. Source: www.guru99.com DATA RETRIEVAL PATTERNS • If you foresee a heavy query usage then consider the use of indexes in your data model to improve the efficiency of queries. Source: www.guru99.com
Comments