MongoDB won't connect to MongoHQ using Mongoid

前端 未结 3 1057
你的背包
你的背包 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:26

    For a replica set / non-replica-set on MongoHQ:

    production:
      sessions:
        default:
          <% if ENV['MONGOHQ_HOST_LIST'] %>
          database: <%= ENV['MONGOHQ_DATABASE'] %>
          username: <%= ENV['MONGOHQ_USER'] %>
          password: <%= ENV['MONGOHQ_PASSWD'] %>
          hosts:
          <% YAML.parse(ENV['MONGOHQ_HOST_LIST']).value.each do |v| %>
            - <%= "#{v[0].value}:#{v[1].value}" %>
          <% end %>
          <% elsif ENV['MONGOHQ_URL'] %>
          uri: <%= ENV['MONGOHQ_URL'] %>
          <% end %>
          options:
            consistency: :eventual
            safe: true
    

提交回复
热议问题