development:
  clients:
    default:
      # MONGODB_URI includes draft_content_store_development or content_store_development
      # depending on whether we're running content store in draft mode or not.
      uri: <%= ENV['MONGODB_URI'] || 'mongodb://localhost/content_store_development' %>
      options:
        write:
          w: 1

test:
  clients:
    default:
      uri: mongodb://localhost/content_store_test
      options:
        write:
          w: 1
        # In the test environment we lower the retries and retry interval to
        # low amounts for fast failures.
        max_retries: 1
        retry_interval: 0

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>
      options:
        ssl: <%= ENV['MONGO_SSL'] || 'false' %>
        ssl_verify: <%= ENV['MONGO_SSL_VERIFY'] || 'true' %>
        server_selection_timeout: 5
        write:
          w: <%= ENV['MONGO_WRITE_CONCERN'] || 'majority' %>
        read:
          mode: :primary_preferred

development:
  clients:
    default:
      # MONGODB_URI includes draft_content_store_development or content_store_development
      # depending on whether we're running content store in draft mode or not.
      uri: <%= ENV['MONGODB_URI'] || 'mongodb://localhost/content_store_development' %>
      options:
        write:
          w: 1

test:
  clients:
    default:
      uri: mongodb://localhost/content_store_test
      options:
        write:
          w: 1
        # In the test environment we lower the retries and retry interval to
        # low amounts for fast failures.
        max_retries: 1
        retry_interval: 0

production:
  clients:
    default:
      uri: <%= ENV['MONGODB_URI'] %>
      options:
        ssl: <%= ENV['MONGO_SSL'] || 'false' %>
        ssl_verify: <%= ENV['MONGO_SSL_VERIFY'] || 'true' %>
        server_selection_timeout: 5
        write:
          w: <%= ENV['MONGO_WRITE_CONCERN'] || 'majority' %>
        read:
          mode: :secondary_preferred

Set Mongo client to prefer reads from secondaries
Set Mongo client to prefer reads from secondaries

This will spread the read requests across the secondary Mongo instances
automatically and spare the primary from taking all the load as is
happening currently. This should obviate the need to increase the sizes
of the Mongo instances and should also improve performance.
