MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _get_encrypted_fields

Method _get_encrypted_fields

pymongo/synchronous/database.py:306–331  ·  view source on GitHub ↗
(
        self, kwargs: Mapping[str, Any], coll_name: str, ask_db: bool
    )

Source from the content-addressed store, hash-verified

304 )
305
306 def _get_encrypted_fields(
307 self, kwargs: Mapping[str, Any], coll_name: str, ask_db: bool
308 ) -> Optional[Mapping[str, Any]]:
309 encrypted_fields = kwargs.get("encryptedFields")
310 if encrypted_fields:
311 return cast(Mapping[str, Any], deepcopy(encrypted_fields))
312 if (
313 self.client.options.auto_encryption_opts
314 and self.client.options.auto_encryption_opts._encrypted_fields_map
315 and self.client.options.auto_encryption_opts._encrypted_fields_map.get(
316 f"{self.name}.{coll_name}"
317 )
318 ):
319 return cast(
320 Mapping[str, Any],
321 deepcopy(
322 self.client.options.auto_encryption_opts._encrypted_fields_map[
323 f"{self.name}.{coll_name}"
324 ]
325 ),
326 )
327 if ask_db and self.client.options.auto_encryption_opts:
328 options = self[coll_name].options()
329 if options.get("encryptedFields"):
330 return cast(Mapping[str, Any], deepcopy(options["encryptedFields"]))
331 return None
332
333 # See PYTHON-3084.
334 __iter__ = None

Callers 2

create_collectionMethod · 0.95
drop_collectionMethod · 0.95

Calls 2

getMethod · 0.45
optionsMethod · 0.45

Tested by

no test coverage detected