@@ -241,7 +241,7 @@ def kms_request(self, kms_context: MongoCryptKmsContext) -> None:
241241 )
242242 raise exc from final_err
243243
244- def collection_info (self , database : str , filter : bytes ) -> Optional [bytes ]:
244+ def collection_info (self , database : str , filter : bytes ) -> Optional [list [ bytes ] ]:
245245 """Get the collection info for a namespace.
246246
247247 The returned collection info is passed to libmongocrypt which reads
@@ -253,8 +253,11 @@ def collection_info(self, database: str, filter: bytes) -> Optional[bytes]:
253253 :return: The first document from the listCollections command response as BSON.
254254 """
255255 with self .client_ref ()[database ].list_collections (filter = RawBSONDocument (filter )) as cursor :
256+ lst = []
256257 for doc in cursor :
257- return _dict_to_bson (doc , False , _DATA_KEY_OPTS )
258+ lst .append (_dict_to_bson (doc , False , _DATA_KEY_OPTS ))
259+ if len (lst ) > 0 :
260+ return lst
258261 return None
259262
260263 def spawn (self ) -> None :
@@ -548,7 +551,7 @@ def _create_mongocrypt_options(**kwargs: Any) -> MongoCryptOptions:
548551 # For compat with pymongocrypt <1.13, avoid setting the default key_expiration_ms.
549552 if kwargs .get ("key_expiration_ms" ) is None :
550553 kwargs .pop ("key_expiration_ms" , None )
551- return MongoCryptOptions (** kwargs )
554+ return MongoCryptOptions (** kwargs , enable_multiple_collinfo = True )
552555
553556
554557class ClientEncryption (Generic [_DocumentType ]):
0 commit comments