Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Concept of Database: Overview of Mongodb

Understand Concept of Database: Overview of Mongodb with clear explanations, practical examples, and useful tips. This updated guide covers the essential...

Table of Contents

Concept of Database: Overview of Mongodb is easier to understand when the core ideas are paired with practical examples. The sections below explain the topic clearly, highlight useful steps, and point out details that can prevent common errors.

MongoDB is a cross-platform database, operating on the concepts of Collection and Document, it provides high performance, high availability and easy scalability.

Concept Database

Database is a physical container for Collection. Each Database gets its own set of files on the file system. Each MongoDB Server can have multiple databases.

Concept Collection

Collection is a group of Documents in MongoDB. It is equivalent to a table in RDBMS. Therefore, a Collection exists within a single database. Collections do not bind Relationship as other database management systems, so the access is very fast, so each collection can contain many different types unlike the table in the mysql administration system that is the fixed fields. determined. Documents inside a Collection can have many different fields. In particular, all Documents in a Collection are similar or with the same purpose.

Concept of Document

A Document in MongoDB, has a structure similar to the JSON data type, is a set of key-value pairs. Documents with schema dynamics, meaning Document in the same Collection need not have the same set of fields or structures, and common fields in a Collection's Document can hold different data types.

Below ??a ra table shows relationship c?a RDBMS terminology with MongoDB

RDBMSMongoDBDatabase Database Table Collection Tuple / Row Document column Field Table Join Embedded Documents Primary Key Primary Key (Default value is _id provided by MongoDB itself) Database Server and ClientMysqld / Oracle mongod mysql / sqlplus mongo

Simple Document structure

the example below illustrates the Document structure of a Blog site with a key-value pair distinguished by commas.

 { _id : ObjectId ( 7df78ad8902c ) title : 'MongoDB Overview' , description : 'MongoDB is no sql database' , by : 'tutorials point' , url : 'http://www.tutorialspoint.com' , tags : [ 'mongodb' , 'database' , 'NoSQL' ], likes : 100 , comments : [	{ user : 'user1' , message : 'My first comment' , dateCreated : new Date ( 2011 , 1 , 20 , 2 , 15 ), like : 0 }, { user : 'user2' , message : 'My second comments' , dateCreated : new Date ( 2011 , 1 , 25 , 7 , 45 ), like : 5 } ] } 

Here, _id is a 12-byte hexadecimal number to ensure the uniqueness of each Document. You can provide _id while inserting into the Document. If you do not provide it, MongoDB will provide a unique id for each Document. In these 12 bytes, the first 4 bytes are for the current Timestamp, the next 3 bytes for the device ID, the next 2 bytes are the process id of MongoDB Server and the remaining 3 bytes are the possible values.

FAQ

What should you know about concept Database?

Database is a physical container for Collection. Each Database gets its own set of files on the file system. Each MongoDB Server can have multiple databases.

What should you know about concept Collection?

Collection is a group of Documents in MongoDB. It is equivalent to a table in RDBMS. Therefore, a Collection exists within a single database. Collections do not bind Relationship as other database management systems, so the access is very fast, so each.

What should you know about concept of Document?

A Document in MongoDB, has a structure similar to the JSON data type, is a set of key-value pairs. Documents with schema dynamics, meaning Document in the same Collection need not have the same set of fields or structures, and common fields in a Collection's.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.