mongodb setup

 development:

  # Configure available database sessions. (required)
sessions:
   default:
      uri: 'mongodb://[username]:[password]@ds043497.mongolab.com:43497/[database]' 
      options: 
        consistency: :strong
        max_retries: 30
        retry_interval: 1
        timeout: 15
test:
  sessions:
    default:
      database: my_pm_app_test
      hosts:
        - localhost:27017
      options:
        read: primary
        # In the test environment we lower the retries and retry interval to
        # low amounts for fast failures.
        max_retries: 1
        retry_interval: 0
production:
  # Configure available database sessions. (required)
sessions:
    default:
      # The standard MongoDB connection URI allows for easy replica set 
      # connection setup. 
      # Use environment variables or a config file to keep your 
      # credentials safe.
       uri: 'mongodb://[username]:[password]@ds043497.mongolab.com:43497/[database]' 

      options: 
        # The default consistency is :eventual, which reads from 
        # secondaries when possible. 
        # Strong forces reads to primary. 
        # We recommend using strong consistency.
        consistency: :strong

        # max_retries specifies the number of times to attempt an 
        # operation before giving up. Default 30 seconds
        max_retries: 30

        # retry_interval specifies the number of seconds to wait before 
        # retrying a single operation. Default 1 second.
        retry_interval: 1

        # The default timeout is 5, which is the time in seconds for an 
        # operation to time out.
        # We recommend 15 because it allows for plenty of time in most 
        # operating environments.
        # Mongoid doubles the configured value (known issue) so 15 
        # results in a timeout of 30s.
        # Note that if you have a long-running query (over 30 seconds), 
        # it will time out.
        # See our example for long-running queries in the blog post 
        # referenced above.
        timeout: 15

        # Set this to ensure that your writes are a round-trip operation
        # and are confirmed by the system. Default (false).
        safe: true

        # refresh_interval specifies the number of seconds to cache information
        # about a node. Default is 300 seconds (5 minutes).
        refresh_interval: 10

Comments

Popular posts from this blog

Rails 7 Features :: Comparison with Rails 6 and Rails 5