Skip to content

Commit 6491384

Browse files
RUBY-2807 - Add "compressors" option to Mongoid.yml (#5698)
* Add "compressors" option to Mongoid.yml Also removes connection string note from docs * Update docs * Move compressors above SSL in the docs
1 parent 0c85796 commit 6491384

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/reference/configuration.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ for details on driver options.
239239
# not belong to this replica set will be ignored.
240240
replica_set: my_replica_set
241241

242+
# Compressors to use for wire protocol compression. (default is to not use compression)
243+
compressors: ["zstd", "snappy", "zlib"]
244+
242245
# Whether to connect to the servers via ssl. (default: false)
243246
ssl: true
244247

@@ -260,9 +263,6 @@ for details on driver options.
260263
# used to validate certs passed from the other end of the connection.
261264
ssl_ca_cert: /path/to/ca.cert
262265

263-
# Compressors to use. (default is to not use compression)
264-
compressors: [zlib]
265-
266266
# Configure Mongoid-specific options. (optional)
267267
options:
268268
# Application name that is printed to the MongoDB logs upon establishing
@@ -755,9 +755,7 @@ the Ruby driver, which implements the three algorithms that are supported by Mon
755755
requires the `zstd-ruby <https://rubygems.org/gems/zstd-ruby>`_ library to
756756
be installed.
757757

758-
To use wire protocol compression, at least one compressor must be explicitly requested
759-
using either the `compressors URI option <https://www.mongodb.com/docs/manual/reference/connection-string/#mongodb-urioption-urioption.compressors>`_,
760-
or directly within the ``mongoid.yml``:
758+
To use wire protocol compression, configure the Ruby driver options within ``mongoid.yml``:
761759

762760
.. code-block:: yaml
763761

lib/rails/generators/mongoid/config/templates/mongoid.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ development:
9393
# not belong to this replica set will be ignored.
9494
# replica_set: name
9595

96+
# Compressors to use for wire protocol compression. (default is to not use compression)
97+
# "zstd" requires zstd-ruby gem. "snappy" requires snappy gem.
98+
# Refer to: https://www.mongodb.com/docs/ruby-driver/current/reference/create-client/#compression
99+
# compressors: ["zstd", "snappy", "zlib"]
100+
96101
# Whether to connect to the servers via ssl. (default: false)
97102
# ssl: true
98103

0 commit comments

Comments
 (0)