Database Reference
In-Depth Information
The mongod application starts the service or daemon , as it's also called. There are
also many flags you can set when launching the MongoDB applications. For example, the
service lets you specify the path where the database is located ( --dbpath ), show version
information ( --version ), and even print some diagnostic system information (with the
--sysinfo flag)! You can view the entire list of options by including the --help flag when
you launch the service. For now, you can just use the defaults and start the service by
typing mongod in your shell or command prompt.
Using the MongoDB Shell
Once you create the database directory and start the mongod database application
successfully, you're ready to fire up the shell and take a sneak peak at the powers of MongoDB.
Fire up your shell (Unix) or your command prompt (Windows); when you do so,
make sure you are in the correct location, so that the mongo executable can be found.
You can start the shell by typing mongo at the command prompt and hitting the Return
key. You will be immediately presented with a blank window and a blinking cursor (see
Figure 2-1 ). Ladies and gentlemen, welcome to MongoDB!
Figure 2-1. The MongoDB shell
If you start the MongoDB service with the default parameters, and start the shell with
the default settings, you will be connected to the default test database running on your
local host. This database is created automatically the moment you connect to it. This is
one of MongoDB's most powerful features: if you attempt to connect to a database that
does not exist, MongoDB will automatically create it for you. This can be either good or
bad, depending on how well you handle your keyboard.
There's an on-line demo shell available on the MongoDB website where you can try
out any of the commands listed.
Tip
Before taking any further steps, such as implementing any additional drivers that will
enable you to work with your favorite programming language, you might find it helpful to
take a quick peek at some of the more useful commands available in the MongoDB shell
(see Table 2-2 ).
 
 
Search WWH ::




Custom Search