Module: Mongo::Operation::Validatable Private
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/mongo/operation/shared/validatable.rb |
Instance Method Summary
-
#validate_array_filters(connection, selector_or_item)
Internal use only
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.
-
#validate_collation(connection, selector_or_item)
Internal use only
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.
- #validate_find_options(connection, selector) Internal use only
-
#validate_hint_on_update(connection, selector_or_item)
Internal use only
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.
- #validate_updates(connection, updates) Internal use only
Instance Method Details
#validate_array_filters(connection, selector_or_item)
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 58
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)
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 69
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)
[ GitHub ]# File 'lib/mongo/operation/shared/validatable.rb', line 24
def (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)
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 47
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)
[ GitHub ]# File 'lib/mongo/operation/shared/validatable.rb', line 77
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