MongoDB is an open-source, NoSQL database system that stores data in a flexible JSON like format called BSON (Binary JSON). It uses dynamic schemas, meaning that, unlike relational databases, MongoDB does not require a predefined schema before you add data to a database. You can alter the schema at any time and as often as necessary without having to set up a new database with an updated schema. It is designed to handle large volumes of data and provides high performance for both read and write operations. Developers and organizations that deal with large and evolving datasets use MongoDB for its scalability, flexibility, and ease of use.
Here is a step by step guide to set up MongoDB on Windows.
Select the version of MongoDB Community Server-7.0.11
Select Windows system -x64.
Select .msi and click Download.
MongoDB Compass: MongoDB Compass is a graphical user interface (GUI) tool provided by MongoDB to interact with MongoDB databases. It allows developers and database administrators to visually explore their data, run ad hoc queries, manage indexes, and perform various other tasks related to MongoDB databases.
C:\Program Files\MongoDB\Server\7.0\bin
MongoDB Shell: MongoShell, also known as the MongoDB Shell or simply mongo, is an interactive JavaScript interface to MongoDB, which allows developers and administrators to interact with MongoDB instances directly through a command-line interface (CLI). It’s a powerful tool that provides a way to perform various operations, such as querying and updating data, managing indexes, and executing administrative commands.
Select the latest version-2.2.9
Select the platform-x64
Select the package-.msi. Click on Download.
22. Click Install on MongoDB Shell setup.
24. Now, cmd prompt in search bar and select Command Prompt and select open, to check MongoDB and Mongo shell installations.
Command: C:\Users\Drushti 5>mongod –version
It will show the version as V7.0.11.
Command: C:\Users\Drushti 5>mongosh
If mongosh installation is successful, we get message as shown below.
Command: test> show dbs
To create new database, type use ss (ss is name of the new database).
Command: test> use ss
Now, it switches to new database that is ss.
Command: ss> db.createCollection(“students”)
A message is displayed saying that 1 collection is created in the MongoDB.
{ok:1}
And that’s it! You have successfully set up a MongoDB database. We can work on MongoDB by giving different commands.
Have additional questions? Search below: