MongoDB is a document-oriented NoSQL database that stores objects in the following hierarchy:
If you are coming from a relational SQL database background (I do), then it might help to think of collections as tables, and of documents as rows in that table. It's not a perfect analogy, however; the key idea of a document-oriented database like MongoDB is that documents within the same collection do not need to have the same structure, while each row in a table of a relational database does have the same structure.
Here is how actual data in this hierarchy might actually look like:
This example represents the case where one has a MongoDB server running on localhost, with two databases customers and invoices. Each database contains some documents that are similar, but not identical, in structure.
As you can see, I have represented the document objects in JavaScript object notation –...