Skip to content

Commit

Permalink
RUBY-2807 - Add "compressors" option to Mongoid.yml (#5698)
Browse files Browse the repository at this point in the history
* Add "compressors" option to Mongoid.yml

Also removes connection string note from docs

* Update docs

* Move compressors above SSL in the docs
  • Loading branch information
johnnyshields authored Nov 13, 2023
1 parent 0c85796 commit 6491384
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 4 additions & 6 deletions docs/reference/configuration.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ for details on driver options.
# not belong to this replica set will be ignored.
replica_set: my_replica_set

# Compressors to use for wire protocol compression. (default is to not use compression)
compressors: ["zstd", "snappy", "zlib"]

# Whether to connect to the servers via ssl. (default: false)
ssl: true

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

# Compressors to use. (default is to not use compression)
compressors: [zlib]

# Configure Mongoid-specific options. (optional)
options:
# Application name that is printed to the MongoDB logs upon establishing
Expand Down Expand Up @@ -755,9 +755,7 @@ the Ruby driver, which implements the three algorithms that are supported by Mon
requires the `zstd-ruby <https://rubygems.org/gems/zstd-ruby>`_ library to
be installed.

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

.. code-block:: yaml

Expand Down
5 changes: 5 additions & 0 deletions lib/rails/generators/mongoid/config/templates/mongoid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ development:
# not belong to this replica set will be ignored.
# replica_set: name

# Compressors to use for wire protocol compression. (default is to not use compression)
# "zstd" requires zstd-ruby gem. "snappy" requires snappy gem.
# Refer to: https://www.mongodb.com/docs/ruby-driver/current/reference/create-client/#compression
# compressors: ["zstd", "snappy", "zlib"]

# Whether to connect to the servers via ssl. (default: false)
# ssl: true

Expand Down

0 comments on commit 6491384

Please sign in to comment.