I am new to work with the ruby on rails with the mongodb, but i can setup my application structure properly.can someone help me to start with it. any example or sample is appreciable.
1 Answer
First you have to add gem 'mongoid', '~> 5.0.0.beta', github: 'mongoid/mongoid' in your gem file.
After that add your_app/config/mongoid.yml file
development:
clients:
default:
database: database_name
hosts:
- localhost:27017
Then add any Model, you can add number of fields
class Model
include Mongoid::Document
field :name, type: String
end
Then you can test using console.