Skip to content

Commit

Permalink
Merge branch 'master' into add-script-to-check-monkey-patches
Browse files Browse the repository at this point in the history
  • Loading branch information
jamis authored Nov 13, 2023
2 parents 0d071af + 6491384 commit ff74714
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 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
7 changes: 3 additions & 4 deletions lib/mongoid/persistable/updatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,15 @@ def update_document(options = {})
unless updates.empty?
coll = collection(_root)
selector = atomic_selector

# TODO: DRIVERS-716: If a new "Bulk Write" API is introduced, it may
# become possible to handle the writes for conflicts in the following call.
coll.find(selector).update_one(positionally(selector, updates), session: _session)

# The following code applies updates which would cause
# path conflicts in MongoDB, for example when changing attributes
# of foo.0.bars while adding another foo. Each conflicting update
# is applied using its own write.
#
# TODO: MONGOID-5026: reduce the number of writes performed by
# more intelligently combining the writes such that there are
# fewer conflicts.
conflicts.each_pair do |modifier, changes|

# Group the changes according to their root key which is
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
5 changes: 0 additions & 5 deletions spec/mongoid/persistable/savable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@
expect(truck.crates[0].toys[0].name).to eq "Teddy bear"
expect(truck.crates[1].volume).to eq 0.8
expect(truck.crates[1].toys.size).to eq 0

# TODO: MONGOID-5026: combine the updates so that there are
# no conflicts.
#expect(truck.atomic_updates[:conflicts]).to eq nil

expect { truck.save! }.not_to raise_error

_truck = Truck.find(truck.id)
Expand Down

0 comments on commit ff74714

Please sign in to comment.