Module: Mongo::BulkWrite::Validatable Private
Do not use. This module is for internal use only.
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Included In:
| |
| Defined in: | lib/mongo/bulk_write/validatable.rb |
Overview
Defines behavior around validations.
Instance Method Summary
-
#validate(name, document) ⇒ Hash, BSON::Document
Internal use only
Validate the document.
- #validate_document(name, document) private Internal use only
- #validate_operation(name) private Internal use only
Instance Method Details
#validate(name, document) ⇒ Hash, BSON::Document
Validate the document.
# File 'lib/mongo/bulk_write/validatable.rb', line 40
def validate(name, document) validate_operation(name) validate_document(name, document) @has_collation = true if document.respond_to?(:keys) && (document[:collation] || document[Operation::COLLATION]) @has_array_filters = true if document.respond_to?(:keys) && document[:array_filters] return unless document.respond_to?(:keys) && document[:hint] @has_hint = true end
#validate_document(name, document) (private)
# File 'lib/mongo/bulk_write/validatable.rb', line 54
def validate_document(name, document) unless document.respond_to?(:keys) || document.respond_to?(:data) raise Error::InvalidBulkOperation.new(name, document) end document end
#validate_operation(name) (private)
# File 'lib/mongo/bulk_write/validatable.rb', line 62
def validate_operation(name) return if Transformable::MAPPERS.key?(name) raise Error::InvalidBulkOperationType.new(name) end