Raj
Raj

Reputation: 649

how to change the database to mongodb from sqlite

I am trying to use the mongodb with ruby on rails

whenever i try to create the new project with

rails new exRuby

preference will be set to sqlite3 in /exRuby/config/database.yml file And automatically "gem 'sqlite3' added to Gem file

But I am trying to use the mongodb with my project. and mongodb is already installed in my system

How to change the database storage to mongodb from sqlite3

Upvotes: 1

Views: 2276

Answers (1)

TheDude
TheDude

Reputation: 3952

Like 'mu is too short' stated, you need to decide which MongoDB interface / gem you want to use to connect to MongoDB. Here is a guide on how to setup a ruby app using Mongoid.

You can run the command rails g mongoid:config to generate the mongoid.yml file. But this is if you choose to use Mongoid. Look at the other gems available and see which one you prefer. Here is a list of available options (according to the MongoDB docs).

Upvotes: 1

Related Questions