From 6491384c51640374863e31bc9d6476c3f5d46d9d Mon Sep 17 00:00:00 2001 From: Johnny Shields <27655+johnnyshields@users.noreply.github.com> Date: Tue, 14 Nov 2023 01:40:16 +0900 Subject: [PATCH] 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 --- docs/reference/configuration.txt | 10 ++++------ .../generators/mongoid/config/templates/mongoid.yml | 5 +++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/reference/configuration.txt b/docs/reference/configuration.txt index ffb4e8e36e..fe89b0a572 100644 --- a/docs/reference/configuration.txt +++ b/docs/reference/configuration.txt @@ -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 @@ -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 @@ -755,9 +755,7 @@ the Ruby driver, which implements the three algorithms that are supported by Mon requires the `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 `_, -or directly within the ``mongoid.yml``: +To use wire protocol compression, configure the Ruby driver options within ``mongoid.yml``: .. code-block:: yaml diff --git a/lib/rails/generators/mongoid/config/templates/mongoid.yml b/lib/rails/generators/mongoid/config/templates/mongoid.yml index 055d6cb255..bf4d5451a3 100644 --- a/lib/rails/generators/mongoid/config/templates/mongoid.yml +++ b/lib/rails/generators/mongoid/config/templates/mongoid.yml @@ -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