If you are interested to learn about the MongoDB GridFS
What is RockMongo?
You can manage your server, databases, collections, documents, indexes, and much more with RockMongo, a MongoDB administration tool. It offers an extremely streamlined method for creating, reading, and writing documents. It is comparable to the PHPMyAdmin utility for MySQL and PHP.
How to Install RockMongo tool?
The following are the steps for the installation of the RockMongo tool.
Step 1: – The downloaded zip file can be unzipped on the web server root folder and we can rename the package according to our choice (say rock-mongo).
Step 2: – Make sure that your web server is running, then open the web browser and access the index.php page which is present inside the rock-mongo folder.
Step 3: – You may require php_mongo.dll file to be included under your ‘/php/ext’. It can be downloaded from the following link.
Step 4: – Add the following extension inthe /php/php.ini file.
Step 5: – If you require to implement step 3 and 4 then you may require the web server restart. Otherwise, directly jump to step 6.
Step 6: – When your web server is up and running. You can browse the following URL in the web browser.
Step 7: – Enter the following default credentials in order to login into RockMongo tool.
Working with RockMongo
We will now be looking at some basic operations that you can perform with RockMongo.
Creating New Database
To create a new database, click Databases tab. Click Create New Database. On the next screen, provide the name of the new database and click on Create. You will see a new database getting added in the left panel.
Creating New Collection
To create a new collection inside a database, click on that database from the left panel. Click on the New Collection link on top. Provide the required name of the collection. Do not worry about the other fields of Is Capped, Size and Max. Click on Create. A new collection will be created and you will be able to see it in the left panel.
Creating New Document
To create a new document, click on the collection under which you want to add documents. When you click on a collection, you will be able to see all the documents within that collection listed there. To create a new document, click on the Insert link at the top. You can enter the document’s data either in JSON or array format and click on Save.
To import/export data of any collection, click on that collection and then click on Export/Import link on the top panel. Follow the next instructions to export your data in a zip format and then import the same zip file to import back data.
RockMongo Tool Application
The RockMongo tool helps perform multiple DB operations in the similar way as PHPMyAdmin allows operations for MySQL database. Here, in this chapter we are going to discuss some of the basic database operations, which are very frequently used while working with MongoDB.
1. Creation of New database in MongoDB via RockMongo tool: – We can create a new database using the RockMongo tool by simply clicking on the Databases tab. Next, click on “Create New Databases” link. It will take you to a new screen where you need to provide the new database name that you want to create. Click on the Create link to finish new database creation in MongoDB. After this step, you can see that on the left panel of RockMongo console, a new database has been created.
2. Creation of New Collection in MongoDB via RockMongo tool: – We can create a new collection inside a database using the RockMongo tool and by simply clicking on Database from the left panel. Next, click on the “New Collection” link present on the top. Next, you need to provide the new collection name which you want to create. Click on the Create link to finish new collection creation in MongoDB for the selected database. After this step, you can see that in the left panel of RockMongo console, a new collection has been created. You can configure collection fields such as Is Capped, Max, and Size, etc. later after the creation of the collection.
3. Creation of New Document in MongoDB via RockMongo tool: – We can create a new document inside a collection using the RockMongo tool by simply clicking on Collection on the left panel. When you click on a particular collection where you want to add a new document, you can see that all of the existing documents present in that collection listed down on the console. Now, simply click on the “insert” link present at the top in order to create a new document within the selected collection. You can insert the required data within the document either in an array format or JSON format. Next, click on the “Save” link to persist the data permanently.
4. Export and Import Data using RockMongo tool: – We can easily import and export data for any collection present in MongoDB via the RockMongo tool. We need to click on the collection present on the left hand panel for which we need to import and export data. Next, click on the “Export / Import” link present on the top panel. Now, you need to follow the given instructions in order to export the required data in zip format or import back the required data through an external zip formatted file.
How to Connect to Rockmongo on Windows?
If you want to access Rockmongo on Windows then follow these steps:
- In the “Connection→SSH→Tunnels” section, add the following values: Source port: 8888 and Destination: localhost:80
- Now click on “Add” button to add secure tunnel configuration to the session.
- Click on “Save” button.
- Click the “Open” button to open an SSH session to the server.
- Access the Rockmongo console using http://127.0.0.1:8888/rockmongo.
- After this you have to login and after that you will get a page like this:
If you are unable to access it, verify the SSH tunnel that was created by checking the PuTTY event log.
So, this was all about Rockmongo Tutorial. Hope, you liked our explanation.
Hence, we studied about step to install rockmongo with tool application. In addition, we discuss how to connect rockmongo to windows with example.
Still, if you have any query, feel free to ask in the comment section.