I have a small issue with Rails and mongodb. I have a small app which works great in development mode. It also works in production mode, but when I enter the rails console I can't see anything in it.
user-001@marcus:/var/www/webapp% rails c RAILS_ENV="production"
You did not specify how you would like Rails to report deprecation notices for your RAILS_ENV=production environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/RAILS_ENV=production.rb
Loading RAILS_ENV=production environment (Rails 3.2.1)
1.9.3p0 :001 > User.all
=> []
my config/initialize/mongo.rb looks like this
MongoMapper.connection = Mongo::Connection.new('localhost', 27017)
MongoMapper.database = "webapp-#{Rails.env}"
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.connection.connect if forked
end
end
but it also looks empty
$ mongo localhost:27017/mail1up-production
MongoDB shell version: 1.8.2
Fri Feb 17 18:26:00 *** warning: spider monkey build without utf8 support. consider rebuilding with utf8 support
connecting to: localhost:27017/webapp-production
> db.mycollection.stats()
{ "errmsg" : "ns not found", "ok" : 0 }
>
Am I doing something wrong? Why can't I see the data in the database? How can I test it?