MongoDB is powerful but easy to get started with. In this chapter we’ll introduce some of the basic concepts of MongoDB:
A document is the basic unit of data for MongoDB and is roughly equivalent to a row in a relational database management system (but much more expressive).
Similarly, a collection can be thought of as a table with a dynamic schema.
A single instance of MongoDB can host multiple independent databases, each of which can have its own collections.
Every document has a special key,
"_id", that is unique within a
This simple document contains a single key,
"greeting", with a value of
"Hello, world!". Most documents will be more
complex than this simple one and often will contain multiple key/value
As you can see from the example above, values in documents are not just “blobs.” They can be one of several different data types (or even an entire embedded document—see Embedded Documents). In this example ...