Sha256: e41ff3b209ea031cff8a0a6603007cdb1c566760bf30b522083ce3f46b58948d

Contents?: true

Size: 1.24 KB

Versions: 4

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require "mongo/config/options"
require "mongo/config/validators/option"

module Mongo

  # This module defines configuration options for Mongo.
  #
  # @api private
  module Config
    extend Forwardable
    extend Options
    extend self

    # When this flag is off, an aggregation done on a view will be executed over
    # the documents included in that view, instead of all documents in the
    # collection. When this flag is on, the view fiter is ignored.
    option :broken_view_aggregate, default: true

    # When this flag is set to false, the view options will be correctly
    # propagated to readable methods.
    option :broken_view_options, default: true

    # When this flag is set to true, the update and replace methods will
    # validate the paramters and raise an error if they are invalid.
    option :validate_update_replace, default: false

    # Set the configuration options.
    #
    # @example Set the options.
    #   config.options = { validate_update_replace: true }
    #
    # @param [ Hash ] options The configuration options.
    def options=(options)
      options.each_pair do |option, value|
        Validators::Option.validate(option)
        send("#{option}=", value)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo-2.18.3 lib/mongo/config.rb
mongo-2.18.2 lib/mongo/config.rb
mongo-2.18.1 lib/mongo/config.rb
mongo-2.18.0 lib/mongo/config.rb