EDUCBA

EDUCBA

MENUMENU
  • Explore
    • Lifetime Membership
    • All in One Bundles
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign up
Home Data Science Data Science Tutorials MongoDB Tutorial MongoDB Relational Database

MongoDB Relational Database

Updated March 15, 2023

MongoDB Relational Database

Introduction to MongoDB Relational Database

The following article provides an outline for MongoDB Relational Database. MongoDB is a No SQL database that is open source and document-oriented. It is written in C++ and provides high performance and availability. It provides auto-scaling and document-oriented databases. Initially, it was developed in 2007 in New York as PaaS( Platform as a Service) that was designed to work with big data technologies with fast features and flexible development. It provides scalability, better performance and high availability offering document-oriented storage that stores data as documents.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

How to Use MongoDB?

  • MongoDB works on key-value pairs. It has a database module that acts as a physical container for all of the collection. MongoDB can have multiple databases.
  • It also consists of a collection that is equivalent to a table in RDMS, it can contain documents that are a set of key-value pairs these documents due to storing the values in KEY VALUE have dynamic schema modelling. Documents can have different fields, it provides the horizontal scalability.
  • The document is the same as Tuple/Row in RDBMS, the data is stored as documents in MongoDB as JSON file formatted in name/value pair. The data is stored in BSON that is the Binary JSON.
  • The cursor is a pointer in MongoDB that has the result set of a Query. We can iterate through the cursor to retrieve the result. We cannot use join in MongoDB as it is stored in a single collection.
  • A name-value pair is called a field in a document, which can be zero or more fields.

Features of MongoDB

Given below are the features of MongoDB:

  • No SQL Database: MongoDB is a No SQL database that is a document-oriented database.
  • Replica: MongoDB supports the Master-Slave Replica. The master can perform the Read Write operation and the data is stored in Slave as a backup.
  • Document Oriented: The data is stored as a document.
  • MongoDB is written in C++.
  • Schema Less: MongoDB is schema-less.
  • Scalable: MongoDB is scalable and provides the property of ease of scaling out.
  • Adhoc Query Support: MongoDB supports the Adhoc Query where a user can search by field and supports the regular expression.
  • Indexing: We can index any field that is used in MongoDB.
  • High Performance: MongoDB provides high performance to users and is relatively faster.
  • It supports data with a dynamic schema where schema can be changed.
  • High File Size Storage: MongoDB has the capacity of storing the high file storage having the ease of handling and querying the data.
  • Easy Support and Failure Recovery: It provides easy support over data and failure recovery mechanisms to handle query processing data.
  • Sharding: MongoDB stores data across multiple machines and that helps to handle bulk data.
  • Freedom to run anywhere, MongoDB can run anywhere globally having the leverage of processing data throughout.
  • Load Balancing: The data is horizontally split over MongoDB that allows load balancing where it can run over multiple servers and in case of any failure the data is up and recovered.
  • Different data integrity pattern is not explicitly required in MongoDB. Normalization of data is not much required in MongoDB.

Examples of MongoDB Relational Database

Given below are the examples mentioned:

Let’s try making a key-value document data in MongoDB and try getting the data in.

Code:

[
{
FirstName: "Arpit",
LastName: "Anand",
Age: "23",
phone: "90000000"
},
{
FirstName: "Michale",
LastName: "John",
Age: "23",
phone: "9000000"
},
{
First_Name: "Kate",
Last_Name: "Lowe",
Age: "24",
phone: "900002222"
}
]

This contains the name, age and phone.

Output:

MongoDB Relational Database 1

Let’s find one Mongo Query and find the result.

This find method returns a cursor to the result. It selects the documents from a collection and the cursor is returned from the selected document. It returns a pointer and is returned by one.

Output:

MongoDB Relational Database 2

The output creates the key-value pair with the _id column embedded in it.

Output:

MongoDB Relational Database 3

The _id is a unique ID that is created that is the object ID for the key-value pair to be used.

Let’s check some of the queries that can be used with the MongoDB.

1. Creation of Database MongoDB: This query is used for the creation of the database.

Code:

Use db;

Deletion of Database in MongoDB.

2. Db.dropDatabase(): This query is used to drop the database.

Output:

Db.dropDatabase()

3. Creation of Collection: This query is used to create the collection.

Code:

Db.createCollection(“collecitonName”)

Output:

Creation of Collection

4. Drop Collection: This query is used to drop the collection in Mongo.

Code:

Db.collectionName.drop()

Output:

Drop Collection

Conclusion

From various examples and architecture, we tried to see how this MongoDB works and what use in the SQL level. The various query model showed the use case handling and working over MongoDB. We also saw the internal working and features of Mongo and its usage for various programming purposes. This article covered the basic MongoDB working, features and examples to clear the No SQL MongoDB.

Recommended Articles

This is a guide to MongoDB Relational Database. Here we discuss the introduction, how to use MongoDB? features and examples respectively. You may also have a look at the following articles to learn more –

  1. MongoDB Join
  2. MongoDB findOne()
  3. MongoDB Date Query
  4. MongoDB Database
ADVERTISEMENT
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
Financial Analyst Masters Training Program
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
All in One Data Science Bundle
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
ADVERTISEMENT
All in One Software Development Bundle
5000+ Hours of HD Videos
149 Learning Paths
1050+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Blog as Guest
Courses
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

🚀 Extended Cyber Monday Price Drop! All in One Universal Bundle (3700+ Courses) @ 🎁 90% OFF - Ends in ENROLL NOW