Tôi hiện đang sử dụng các cài đặt sau (mà không làm việc) trong mongoid.yml của tôi và tôi đã thêm một cách chính xác các biến môi trường MONGOLAB_URI
với môi trường Heroku tôi:Tại sao mongoDB lưu trữ cài đặt uri của tôi cho mongoid.yml không hoạt động chính xác?
production:
sessions:
default:
another:
uri: <%= ENV['MONGOLAB_URI'] %>
Tôi cũng thử như sau mà không hoạt động:
production:
uri: <%= ENV['MONGOLAB_URI'] %>
này cũng không hoạt động:
production:
sessions:
default:
uri: <%= ENV['MONGOLAB_URI'] %>
Tôi nhận được lỗi sau trên push Heroku:
Running: rake assets:precompile
There is a configuration error with the current mongoid.yml.
Problem:
No database provided for session configuration: :default.
Summary:
Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"another"=>{"uri"=>nil}}.
Resolution:
If configuring via a mongoid.yml, ensure that within your :default section a :database value for the session's default database is defined.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_default:
\_\_\_\_\_\_\_\_database: my_app_db
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
There is a configuration error with the current mongoid.yml.
Problem:
No database provided for session configuration: :default.
Summary:
Each session configuration must provide a database so Mongoid knows where the default database to persist to. What was provided was: {"another"=>{"uri"=>nil}}.
Resolution:
If configuring via a mongoid.yml, ensure that within your :default section a :database value for the session's default database is defined.
Example:
\_\_development:
\_\_\_\_sessions:
\_\_\_\_\_\_default:
\_\_\_\_\_\_\_\_database: my_app_db
\_\_\_\_\_\_\_\_hosts:
\_\_\_\_\_\_\_\_\_\_- localhost:27017
Asset precompilation completed (15.47s)
Tôi đang làm gì sai ở đây? Tôi đã theo các hướng dẫn mongoid.org:
http://mongoid.org/en/mongoid/docs/installation.html
Tôi đang sử dụng mongoid 3.0.0.rc
này không làm việc cho tôi. Cảm ơn sự giúp đỡ mặc dù – Goalie
giá trị của ENV ['MONGOLAB_URI'] là gì? – abhas
Tôi đã thay đổi một số mục cho mục đích bảo mật nhưng đây là cách nó trông giống như: 'mongodb: // testappuser: [email protected]: 97321/testapp_production' – Goalie