Setting up MongoDB with Autoparts
Last Updated on: 15 September 2013
This guide walks through how you can setup a MongoDB database on your Nitrous.IO box.
- Nitrous.IO box with the package manager Autoparts installed. To ensure Autoparts is installed, run the command
partswithin the terminal. Take a look at the Autoparts guide for installation instructions.
To install MongoDB with the autoparts package manager, run the following command:
parts install mongodb
Configuring MongoDB for a Rails App
Before making configuration, start up MongoDB with the following command:
parts start mongodb
When building a Rails app, run the following command to skip active record and test unit:
rails new myapp --skip-active-record --skip-test-unit
Rails 4 requires the latest version of
mongoid, which also includs
bson_ext as a dependency. Add the following lines to your
gem 'mongoid', git: 'https://github.com/mongoid/mongoid.git' gem 'bson_ext'
Gemfile has been updated, run the following:
Next, generate the configuration:
rails g mongoid:config
If you are wanting to connect to an external database, please view the guide on Connecting to MongoLabs.