Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bindings/python/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Changelog
Changes in Version 1.13.0
-------------------------

- Bundle libmongocrypt 1.13.0 in release wheels.
- Add support for the key_expiration_ms option to MongoCryptOptions.
- Add support for $lookup in CSFLE and QE

Changes in Version 1.12.0
-------------------------
Expand Down
8 changes: 6 additions & 2 deletions bindings/python/pymongocrypt/asynchronous/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async def collection_info(self, database, filter):
- `filter`: The filter to pass to listCollections.

:Returns:
The first document from the listCollections command response as BSON.
The all or first document from the listCollections command response as BSON.
"""

@abstractmethod
Expand Down Expand Up @@ -125,7 +125,11 @@ async def run_state_machine(ctx, callback):
list_colls_filter = ctx.mongo_operation()
coll_info = await callback.collection_info(ctx.database, list_colls_filter)
if coll_info:
ctx.add_mongo_operation_result(coll_info)
if isinstance(coll_info, list):
for i in coll_info:
ctx.add_mongo_operation_result(i)
else:
ctx.add_mongo_operation_result(coll_info)
ctx.complete_mongo_operation()
elif state == lib.MONGOCRYPT_CTX_NEED_MONGO_MARKINGS:
mongocryptd_cmd = ctx.mongo_operation()
Expand Down
17 changes: 16 additions & 1 deletion bindings/python/pymongocrypt/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def _parse_version(version):

# Start embedding from update_binding.py
ffi.cdef(
"""/*
"""
/*
* Copyright 2019-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -323,6 +324,16 @@ def _parse_version(version):
*/
bool mongocrypt_setopt_retry_kms(mongocrypt_t *crypt, bool enable);

/**
* Enable support for multiple collection schemas. Required to support $lookup.
*
* @param[in] crypt The @ref mongocrypt_t object.
* @pre @ref mongocrypt_init has not been called on @p crypt.
* @returns A boolean indicating success. If false, an error status is set.
* Retrieve it with @ref mongocrypt_ctx_status
*/
bool mongocrypt_setopt_enable_multiple_collinfo(mongocrypt_t *crypt);

/**
* Configure an AWS KMS provider on the @ref mongocrypt_t object.
*
Expand Down Expand Up @@ -1466,6 +1477,10 @@ def _parse_version(version):

/// String constants for setopt_query_type
// DEPRECATED: Support "rangePreview" has been removed in favor of "range".
/// NOTE: "substringPreview" is experimental and may be removed in a future non-major release.
/// NOTE: "suffixPreview" is experimental and may be removed in a future non-major release.
/// NOTE: "prefixPreview" is experimental and may be removed in a future non-major release.

"""
)
# End embedding from update_binding.py
Expand Down
3 changes: 3 additions & 0 deletions bindings/python/pymongocrypt/mongocrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def __init(self):
if self.__opts.bypass_query_analysis:
lib.mongocrypt_setopt_bypass_query_analysis(self.__crypt)

if self.__opts.enable_multiple_collinfo:
lib.mongocrypt_setopt_enable_multiple_collinfo(self.__crypt)

# Prefer using the native crypto binding when we know it's available.
try:
crypto_available = lib.mongocrypt_is_crypto_available()
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/pymongocrypt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def __init__(
crypt_shared_lib_required=False,
bypass_encryption=False,
key_expiration_ms=None,
enable_multiple_collinfo=False,
):
"""Options for :class:`MongoCrypt`.

Expand Down Expand Up @@ -156,6 +157,7 @@ def __init__(
self.crypt_shared_lib_required = crypt_shared_lib_required
self.bypass_encryption = bypass_encryption
self.key_expiration_ms = key_expiration_ms
self.enable_multiple_collinfo = enable_multiple_collinfo


class ExplicitEncryptOpts:
Expand Down
8 changes: 6 additions & 2 deletions bindings/python/pymongocrypt/synchronous/state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def collection_info(self, database, filter):
- `filter`: The filter to pass to listCollections.

:Returns:
The first document from the listCollections command response as BSON.
The all or first document from the listCollections command response as BSON.
"""

@abstractmethod
Expand Down Expand Up @@ -125,7 +125,11 @@ def run_state_machine(ctx, callback):
list_colls_filter = ctx.mongo_operation()
coll_info = callback.collection_info(ctx.database, list_colls_filter)
if coll_info:
ctx.add_mongo_operation_result(coll_info)
if isinstance(coll_info, list):
for i in coll_info:
ctx.add_mongo_operation_result(i)
else:
ctx.add_mongo_operation_result(coll_info)
ctx.complete_mongo_operation()
elif state == lib.MONGOCRYPT_CTX_NEED_MONGO_MARKINGS:
mongocryptd_cmd = ctx.mongo_operation()
Expand Down
16 changes: 8 additions & 8 deletions bindings/python/sbom.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"components": [
{
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.12.0",
"bom-ref": "pkg:github/mongodb/libmongocrypt@1.13.0",
"externalReferences": [
{
"type": "distribution",
"url": "https://github.com/mongodb/libmongocrypt/archive/refs/tags/1.12.0.tar.gz"
"url": "https://github.com/mongodb/libmongocrypt/archive/refs/tags/1.13.0.tar.gz"
},
{
"type": "website",
"url": "https://github.com/mongodb/libmongocrypt/tree/1.12.0"
"url": "https://github.com/mongodb/libmongocrypt/tree/1.13.0"
}
],
"group": "mongodb",
"name": "libmongocrypt",
"purl": "pkg:github/mongodb/libmongocrypt@1.12.0",
"purl": "pkg:github/mongodb/libmongocrypt@1.13.0",
"type": "library",
"version": "1.12.0"
"version": "1.13.0"
}
],
"dependencies": [
{
"ref": "pkg:github/mongodb/libmongocrypt@1.12.0"
"ref": "pkg:github/mongodb/libmongocrypt@1.13.0"
}
],
"metadata": {
"timestamp": "2024-12-30T18:25:06.574241+00:00",
"timestamp": "2025-03-17T23:00:23.984416+00:00",
"tools": [
{
"externalReferences": [
Expand Down Expand Up @@ -68,7 +68,7 @@
}
]
},
"serialNumber": "urn:uuid:5e81b4d2-1313-43dd-9ec0-b958d0d71bca",
"serialNumber": "urn:uuid:c500f8af-9297-400c-9624-92eb9584a8aa",
"version": 1,
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/scripts/libmongocrypt-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.12.0
1.13.0
2 changes: 2 additions & 0 deletions bindings/python/scripts/update_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def update_bindings():
new_lines.append(")")
new_lines.append(line)
skip = False
with target.open("w") as f:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

f.write("\n".join(new_lines))


if __name__ == "__main__":
Expand Down
Loading