Basic MongoDB shell commands and a list of Web GUIs

May 23, 2015 08:07 GMT  ·  By

MongoDB is currently the world's most used NoSQL database system, ranking fourth overall behind relational database engines like Oracle, MySQL, and Microsoft's SQL Server. The success of this database system stems from its simple approach to data storage, recording data as JSON-like documents instead of rigid table structures.

This allows developers to store and query information that's not necessarily well organized, and also scale the database without the same resource usage as compared to classic relational DB engines.

If you want to test MongoDB out and see what all the fuss is about, there are a basic set of concepts you need to get a grip on. The database is open sourced, works on all major operating systems, and features a simple installation method, with automated installers and in-depth setup instructions available on Mongo's wiki section, for running the database sparingly for tests, or as a service/daemon on servers.

Core and shell basics

The database's default port is 27017, but this can be changed if ever needed. Another important port is 28017, which is the Web console port. This allows developers to access http://localhost:28017 and view a basic status of their MongoDB installation. It's not that powerful, but we'll recommend some better Web-based GUIs later on in this article.

Just like MySQL, PostgreSQL, and other database systems, MongoDB also comes with a console where basic operations can be run. The most basic commands are:

code
db
show dbs
use
The first one tells you the current active database, the second lists all your databases, while the third switches to a new database, and if the database doesn't exist, it also creates it at the same time. More complex shell commands are available, but there are better ways to manage a database, and the most common is to use desktop or Web-based GUIs.

Desktop and Web-based administration interfaces

We tested a few of them here at Softpedia, and some good solutions rose above the rest. There is Smog (for Node.js), RockMongo (for PHP), phpMoAdmin (for PHP), Genghis (for PHP and Ruby), mViewer (for Java), Fang of Mongo (for Python), Mongo Edit (for Node.js), JMongoBrowser (Windows app), Robomongo (Windows and Mac app), MongoHub (Mac app), and qMongoFront (Linux app).

For PHP developers RockMongo can be used with MongoDB administration tasks
For PHP developers RockMongo can be used with MongoDB administration tasks

If you're a developer, these tools can help you in the final stages of a website or application's creation cycle, and they're more useful for debugging or data administration operations. When writing source code, the utilities that help you the most are the MongoDB database drivers, small libraries that enable your application to talk to the database, querying, fetching and sending data from and to the storage engine.

MongoDB has one of the most complete collection of database drivers around, ranging from well-known languages like Java and PHP to more obscure ones like Haskell and Erlang.

This is a basic rundown of all the important MongoDB features and concepts, and if the versatile manner in which this utilitarian data storage system works appeals to you, there are a plethora of tutorials and documentation on this topic online.

MongoDB and the simple ways of working with it (9 Images)

MongoHub is a MongoDB GUI for the Mac
qMongoFront can help webmasters manage MongoDB on LinuxRobomongo is an app for both Windows and Mac MongoDB users
+6more