module Mongo::Operation::Validatable
@api private
Public Instance Methods
validate_array_filters(connection, selector_or_item)
click to toggle source
selector_or_item here is either:
-
The selector as used in a findAndModify command, or
-
One of the array elements in the updates array in an update command.
# File lib/mongo/operation/shared/validatable.rb, line 57 def validate_array_filters(connection, selector_or_item) if selector_or_item.key?(:arrayFilters) && !connection.features.array_filters_enabled? then raise Error::UnsupportedArrayFilters end end
validate_collation(connection, selector_or_item)
click to toggle source
selector_or_item here is either:
-
The selector as used in a findAndModify command, or
-
One of the array elements in the updates array in an update command.
# File lib/mongo/operation/shared/validatable.rb, line 68 def validate_collation(connection, selector_or_item) if selector_or_item.key?(:collation) && !connection.features.collation_enabled? then raise Error::UnsupportedCollation end end
validate_find_options(connection, selector)
click to toggle source
# File lib/mongo/operation/shared/validatable.rb, line 23 def validate_find_options(connection, selector) if selector.key?(:hint) && !connection.features.find_and_modify_option_validation_enabled? then raise Error::UnsupportedOption.hint_error end if selector.key?(:arrayFilters) && !connection.features.array_filters_enabled? then raise Error::UnsupportedArrayFilters end if selector.key?(:collation) && !connection.features.collation_enabled? then raise Error::UnsupportedCollation end end
validate_hint_on_update(connection, selector_or_item)
click to toggle source
selector_or_item here is either:
-
The selector as used in a findAndModify command, or
-
One of the array elements in the updates array in an update command.
# File lib/mongo/operation/shared/validatable.rb, line 46 def validate_hint_on_update(connection, selector_or_item) if selector_or_item.key?(:hint) && !connection.features.update_delete_option_validation_enabled? then raise Error::UnsupportedOption.hint_error end end
validate_updates(connection, updates)
click to toggle source
# File lib/mongo/operation/shared/validatable.rb, line 76 def validate_updates(connection, updates) updates.each do |update| validate_array_filters(connection, update) validate_collation(connection, update) validate_hint_on_update(connection, update) end updates end