MongoDB overView with Installation_procEss: SQL - Where all to UsE ?
MongoDB
MongoDB (from humongous) is a free and open-source cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schemas. MongoDB is developed by MongoDB Inc. and is free and open-source, published under a combination of the GNU Affero General Public License and the Apache License. Any relational database has a typical schema design that shows number of tables and the relationship between these tables. While in MongoDB, there is no concept of relationship.
Document Database
A record in MongoDB is a document, which is a data structure composed of field and value pairs. MongoDB documents are similar to JSON objects. The values of fields may include other documents, arrays, and arrays of documents. Following is the example of MongoDB documentFollowing are some advantages of using document database
- Documents correspond to native data types in many programming languages.
- Embedded documents and arrays reduce need for expensive joins.
- Dynamic schema supports fluent Polymorphism.
Following are the features of MongoDB
- MongoDB provides high performance data persistence.
- MongoDB supports a rich query language to support read and write operations.
- Extremely faster than RDBMS
- It is easy to use and lightweight.
Lets see advantages of MongoDB over RDBMS
In recent days, MongoDB is a new and popularly used database. It is a document based, non relational database provider.
- MongoDB is schema less. It is a document database in which one collection holds different documents.
- Structure of a single object is clear in MongoDB.
- There are no complex joins in MongoDB.
- Uses internal memory for storing the (windowed) working set, enabling faster access of data.
- MongoDB is easy to scale.
- Conversion/mapping of application objects to database objects not needed.
Where MongoDB should be used?
- Big and complex data
- Mobile and social infrastructure
- Content management and delivery
- User data management
- Data hub
Lets see how to install MongoDB on windows
Setp 1: Download MongoDB for Windows
Download the latest production release of MongoDB.
To find which version of Windows you are running, enter the following commands in the Command Prompt or Powershell:
Step 2: Install MongoDB
In Window explorer, locate the downloaded MongoDB msi file, double click on that file and follow the instructions appears on the screen. These instructions will guide you to complete the installation process.
Step3: Setup MongoDB Environment
MongoDB requires a data folder to store its files. The default location for the MongoDB data directory is c:\data\db. So you need to create this folder using the Command Prompt.
Start If you want to start MongoDB, run mongod.exe or You can do it from command prompt by using following command
C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe
This will start the mongoDB database process. If you get a message "waiting for connection" in the console output, it indicates that the mongodb.exe process is running successfully.
If you will get following error
then click here and follow the steps.
When you connect to the MongoDB through the mongo.exe shell, you should follow these steps:
1. Open another command prompt.
2. At the time of connecting, specify the data directory if necessary.
If you use the default data directory while MongoDB installation, there is no need to specify the data directory.
For example:
C:\mongodb\bin\mongo.exe
If you use the different data directory while MongoDB installation, specify the directory when connecting.
For example:
C:\mongodb\bin\mongod.exe-- dbpath d:\test\mongodb\data
If you have spaces in your path, enclose the entire path in double space.
For example:
C:\mongodb\bin\mongod.exe-- dbpath "d: \ test\mongodb\data"
This will show that MongoDB is installed and run successfully.
MongoDB Help
To get a list of commands, type db.help() in MongoDB client. This will give you a list of commands.
MongoDB Statistics
To get stats about MongoDB server, type the command db.stats() in MongoDB client. This will show the database name, number of collection and documents in the database.
Comments
Post a Comment