Method: Mongo::Crypt::Binding.validate_document
- Defined in:
- lib/mongo/crypt/binding.rb
.validate_document(data) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Note:
All BSON::Document instances are also Hash instances
Checks that the specified data is a Hash before serializing it to BSON to prevent errors from libmongocrypt
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 |
# File 'lib/mongo/crypt/binding.rb', line 1844 def self.validate_document(data) return if data.is_a?(Hash) if data.nil? = "Attempted to pass nil data to libmongocrypt. " + "Data must be a Hash" else = "Attempted to pass invalid data to libmongocrypt: #{data} " + "Data must be a Hash" end raise Error::CryptError.new() end |