Module: Mongo::Collection::QueryableEncryption Private
- Included in:
- Mongo::Collection
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/collection/queryable_encryption.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module contains methods for creating and dropping auxiliary collections for queryable encryption.
Constant Summary collapse
- QE2_MIN_WIRE_VERSION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The minimum wire version for QE2 support
21
Instance Method Summary collapse
-
#maybe_create_qe_collections(encrypted_fields, client, session) ⇒ Result
private
Creates auxiliary collections and indices for queryable encryption if necessary.
-
#maybe_drop_emm_collections(encrypted_fields, client, session) ⇒ Result
private
Drops auxiliary collections and indices for queryable encryption if necessary.
Instance Method Details
#maybe_create_qe_collections(encrypted_fields, client, session) ⇒ Result
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.
Creates auxiliary collections and indices for queryable encryption if necessary.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'build/ruby-driver-v2.19/lib/mongo/collection/queryable_encryption.rb', line 35 def maybe_create_qe_collections(encrypted_fields, client, session) encrypted_fields = encrypted_fields_from(encrypted_fields) return yield if encrypted_fields.empty? server = next_primary(nil, session) context = Operation::Context.new(client: client, session: session) server.with_connection do |connection| check_wire_version!(connection) emm_collections(encrypted_fields).each do |coll| create_operation_for(coll) .execute_with_connection(connection, context: context) end end yield(encrypted_fields).tap do |result| indexes.create_one(__safeContent__: 1) if result end end |
#maybe_drop_emm_collections(encrypted_fields, client, session) ⇒ Result
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.
Drops auxiliary collections and indices for queryable encryption if necessary.
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'build/ruby-driver-v2.19/lib/mongo/collection/queryable_encryption.rb', line 62 def maybe_drop_emm_collections(encrypted_fields, client, session) encrypted_fields = if encrypted_fields encrypted_fields elsif encrypted_fields_map encrypted_fields_for_drop_from_map else {} end return yield if encrypted_fields.empty? emm_collections(encrypted_fields).each do |coll| context = Operation::Context.new(client: client, session: session) operation = Operation::Drop.new( selector: { drop: coll }, db_name: database.name, session: session ) do_drop(operation, session, context) end yield end |