@@ -194,9 +194,7 @@ async def kms_request(self, kms_context: MongoCryptKmsContext) -> None:
194194 # Wrap I/O errors in PyMongo exceptions.
195195 _raise_connection_failure ((host , port ), error )
196196
197- async def collection_info (
198- self , database : AsyncDatabase [Mapping [str , Any ]], filter : bytes
199- ) -> Optional [bytes ]:
197+ async def collection_info (self , database : str , filter : bytes ) -> Optional [bytes ]:
200198 """Get the collection info for a namespace.
201199
202200 The returned collection info is passed to libmongocrypt which reads
@@ -598,6 +596,9 @@ def __init__(
598596 if not isinstance (codec_options , CodecOptions ):
599597 raise TypeError ("codec_options must be an instance of bson.codec_options.CodecOptions" )
600598
599+ if not isinstance (key_vault_client , AsyncMongoClient ):
600+ raise TypeError (f"AsyncMongoClient required but given { type (key_vault_client )} " )
601+
601602 self ._kms_providers = kms_providers
602603 self ._key_vault_namespace = key_vault_namespace
603604 self ._key_vault_client = key_vault_client
@@ -683,6 +684,11 @@ async def create_encrypted_collection(
683684 https://mongodb.com/docs/manual/reference/command/create
684685
685686 """
687+ if not isinstance (database , AsyncDatabase ):
688+ raise TypeError (
689+ f"create_encrypted_collection() requires an AsyncDatabase but { type (database )} given"
690+ )
691+
686692 encrypted_fields = deepcopy (encrypted_fields )
687693 for i , field in enumerate (encrypted_fields ["fields" ]):
688694 if isinstance (field , dict ) and field .get ("keyId" ) is None :
0 commit comments