Database Reference
In-Depth Information
3.2.4
Running MongoDB on Mac OS X
1. Open the “Terminal” application and move to the directory above the mongodb
folder.
2. Run the command ./mongodb/bin/mongod-dbpath data/db
3. Open another tab in Terminal (Cmd-T).
4. Run the command ./mongodb/bin/mongo . This is the command-line inter-
face to MongoDB. You can now issue commands to MongoDB.
3.3
MongoDB's Data Organization
MongoDB organizes its data in the following hierarchy: database, collection, docu-
ment. A database is a set of collections, and a collection is a set of documents. The
organization of data in MongoDB is shown in Fig. 3.2 . Here we will demonstrate
how to interact with each level in this hierarchy to store data.
3.4
How to Execute the MongoDB Examples
The examples presented in this chapter are written in JavaScript - the language
underpinning MongoDB. To run these examples, do the following:
1. Run mongod , as shown above. The process doing this varies is outlined in
Sect. 3.2 .
Database 1
Database 2
Database n
.
.
.
D 1
D 2
D
m
Fig. 3.2
Organization of MongoDB data
Search WWH ::




Custom Search