Database Reference
In-Depth Information
Note that it's also possible to specify all of these options in a config file. Simply create
a new text file (we'll call it mongodb.conf) and you can specify all the preceding
options, one per line:
dbpath=/var/local/mongodb
logpath=/var/log/mongodb.log
port=27018
rest=true
fork=true
You can then invoke mongod using the config file with the -f option:
$ mongod -f mongodb.conf
If you ever find yourself connected to a MongoDB and wondering which options were
used at startup, you can get a list of them by running the getCmdLineOpts command:
> use admin
> db.runCommand({getCmdLineOpts: 1})
A.3
Installing Ruby
A number of the examples in this topic are written in Ruby, so to run them yourself,
you'll need a working Ruby installation. This means installing the Ruby interpreter as
well as Ruby's package manager, RubyGems.
You should use a version of Ruby greater than or equal to 1.8.7. Versions 1.8.7 and
1.9.3 are the most common production versions at the time of this writing.
A.3.1
Linux and Mac OS X
Ruby comes installed by default on Max OS X and on a number of Linux distributions.
You may want to check whether you have a recent version by running
ruby -v
If the command isn't found, or if you're running a version older than 1.8.7, you'll
want to install or upgrade. There are detailed instructions for installing Ruby on Mac
OS X as well as on a number of Unix variants at http://www.ruby-lang.org/en/down-
loads/ (you may have to scroll down the page to see the instructions for the various
platforms). Most package managers (such as MacPorts and Aptitude) also maintain a
recent version of Ruby, and they're likely to be the easiest avenue for getting a work-
ing Ruby installation.
In addition to the Ruby interpreter, you need the Ruby package manager, Ruby-
Gems, to install the MongoDB Ruby driver. Find out whether RubyGems is installed by
running the gem command:
gem -v
You can install RubyGems through a package manager, but most users download the
latest version and use the included installer. Instructions for doing this can be found
at https://rubygems.org/pages/download .
Search WWH ::




Custom Search