A MongoDB deployment hosts a number of databases.
A database holds a set of collections.
A collection holds a set of documents (analogous to JS objects).
A document is a set of key-value pairs (ala { name: ‘value’ } properties in JS object).  Documents have dynamic schema.

Dynamic schema means that documents in the same collection do not need to have the same set of fields or structure, and common fields in a collection’s documents may hold different types of data.

Document = JS object

MongoDB stores all documents in collections.  A collection is a group of related documents that have a set of common indexes.  Collections are analogous to a table in relational databases.

MongoD (daemon process for MongoDB system)

Run database server (using non-standard location):
mongod --dbpath [/path/to/data]
mongod --dbpath /usr/local/var/mongodb/data/db

Connect to mongod:
mongo // start the shell while mongod server is running

show dbs
use [db] // will create db if doesn't already exist
db.dropDatabase(); // drops the current database

URI connection scheme

Default connection port is :27017

Database Operations

Data modification

- create; update or delete.

Create User

    user: "userName",
    pwd: "password",
    roles: [
      { role: "readWrite / read", db: "db" }