MongoDB Introduction


MongoDB (commonly referred to as simply Mongo), a play on the term “humongous,” is a general purpose NoSQL database that provides many large-scale features, such as indexing, sharing, and map/reduce (distributed computing) for big data processing. It is a “document database”, not an “SQL database”.

It is well suited for scenarios in which data is stored in flat files, can leverage JavaScript Object Notation (JSON), or where a schema-free or dynamic-schema approach is required for the data model. Mongo typically is not as effective when an app may have been previously backed by a SQL/RDBMS system and the goal of moving to Mongo is a performance gain.

You can set up a free account.

Note that this mLab account user is not the same as a database user! You can set up database credentials when creating your MongoDB instances.

For some information on installing MongoDB on Windows 10, please view our other post Installing MongoDB on Windows 10.

Commands at the Command Line – The Mongo Shell

> help
        db.help()                    help on db methods
        db.mycoll.help()             help on collection methods
        sh.help()                    sharding helpers
        rs.help()                    replica set helpers
        help admin                   administrative help
        help connect                 connecting to a db help
        help keys                    key shortcuts
        help misc                    misc things to know
        help mr                      mapreduce

        show dbs                     show database names
        show collections             show collections in current database
        show users                   show users in current database
        show profile                 show most recent system.profile entries with time >= 1ms
        show logs                    show the accessible logger names
        show log [name]              prints out the last segment of log in memory, 'global' is default
        use                 set current database
        db.foo.find()                list objects in collection foo
        db.foo.find( { a : 1 } )     list objects in foo where a == 1
        it                           result of the last line evaluated; use to further iterate
        DBQuery.shellBatchSize = x   set default number of items to display on shell
        exit                         quit the mongo shell
> 

If you are interested in a MongoDB GUI, have a look at this article at ScaleGrid. Here is a few comments from that article:

MongoVue is a desktop GUI for the windows platform. It has a simple clean UI and the basic features are free. Data can be presented in text view, tree view or table view. You can also save your find queries for later usage – we find this rather convenient. The more advanced features require you to purchase a license. Overall the software appears stable and well maintained.

MongoDB Compass provides users with a graphical view of their MongoDB schema without requiring the use of query language. In MongoDB, collections do not enforce a rigidly-defined document structure. This can make it difficult to explore and understand the underlying data and its structure without a tool like MongoDB Compass.

MongoDB Compass analyses your documents and displays rich structures within your collections in a simple and intuitive GUI. It allows you to quickly visualize and explore your schema to understand the frequency, types, and ranges of fields in your data set.

There are several others to consider, such as MongoBooster.

Leave a comment

Your email address will not be published. Required fields are marked *