Skip to content

Instantly share code, notes, and snippets.

@bnorton
Last active August 29, 2015 13:55
Show Gist options
  • Save bnorton/8788372 to your computer and use it in GitHub Desktop.
Save bnorton/8788372 to your computer and use it in GitHub Desktop.
mongoid 4.0 config
## :write
# -1 : Don't verify writes and raise no network errors
# 0 : Don't verify writes and raise network errors
# 1 : Verify writes on the primary node. (default)
# n : Verify writes on n number of nodes.
#
## :read
# :primary : Will always read from a primary node. (default)
# :primary_preferred : Attempt a primary first, then secondary if none available.
# :secondary : Will always read from a secondary node.
# :secondary_preferred : Attempt a secondary first, then primary if none available.
# :nearest : Attempt to read from the node with the lowest latency.
#
session_options: &default_session_options
write: { w: 1 }
read: :primary
max_retries: 10
retry_interval: 0.5
environment_options: &default_options
include_root_in_json: false
include_type_for_serialization: false
preload_models: false
raise_not_found_error: true
scope_overwrite_exception: false
use_activesupport_time_zone: true
use_utc: false
development:
sessions:
default:
database: development
hosts:
- localhost:27017
options:
<<: *default_session_options
options:
<<: *default_options
test:
sessions:
default:
database: <%= ENV['DBNAME'] || 'test' %>
hosts:
- localhost:27017
options:
<<: *default_session_options
max_retries: 5
retry_interval: 0
options:
<<: *default_options
all: &redefined
sessions:
default:
uri: 'redefine on deploy'
options:
<<: *default_session_options
options:
<<: *default_options
staging:
<<: &redefined
production:
<<: &redefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment