We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab22353 commit 144c878Copy full SHA for 144c878
pymongo_vectorsearch_utils/util.py
@@ -1,6 +1,9 @@
1
import logging
2
from typing import Any
3
4
+from pymongo import MongoClient, AsyncMongoClient
5
+from pymongo.driver_info import DriverInfo
6
+
7
logger = logging.getLogger(__file__)
8
9
@@ -42,3 +45,9 @@ def oid_to_str(oid: Any) -> str:
42
45
24 character hex string.
43
46
"""
44
47
return str(oid)
48
49
50
+def append_client_metadata(client: MongoClient | AsyncMongoClient, driver_info: DriverInfo) -> None:
51
+ # append_metadata was added in PyMongo 4.14.0, but is a valid database name on earlier versions
52
+ if callable(client.append_metadata):
53
+ client.append_metadata(driver_info)
0 commit comments