MongoDB won't connect to MongoHQ using Mongoid

前端 未结 3 1052
你的背包
你的背包 2021-01-19 19:46

I\'ve just started a brand new rails project and the first task I\'m trying to complete is creating an object and having it save within my database. I went through the auto

3条回答
  •  没有蜡笔的小新
    2021-01-19 20:48

    Database connections currently cannot be made via URI at this point in mongoid. The format of the mongoid.yml is as follows:

    environment:
      host: <%= ENV['MONGOID_HOST'] %>
      port: <%= ENV['MONGOID_PORT'] %>
      username: <%= ENV['MONGOID_USERNAME'] %>
      password: <%= ENV['MONGOID_PASSWORD'] %>
      database: <%= ENV['MONGOID_DATABASE'] %>
    

    What you will need to do is parse the MongoHQ string into its constituent parts to supply in the mongoid.yml

    If you want, someone has cooked up a gist that does this for you here

提交回复
热议问题