PYTHON-5046 Support $lookup in CSFLE and QE#2210
PYTHON-5046 Support $lookup in CSFLE and QE#2210sleepyStick merged 20 commits intomongodb:masterfrom
Conversation
d307b92 to
ea56a2e
Compare
|
pyproject.toml and uv.lock will need to change once mongodb/libmongocrypt#989 is merged :) |
This reverts commit 9306a9e.
ShaneHarvey
left a comment
There was a problem hiding this comment.
Nice work! Could you add a note to the changelog since this is a new feature?
| doc = await unencrypted_client.db.qe2.find_one() | ||
| self.assertTrue(isinstance(doc["qe2"], Binary)) | ||
| await encrypted_client.db.no_schema.insert_one({"no_schema": "no_schema"}) | ||
| await encrypted_client.db.no_schema2.insert_one({"no_schema2": "no_schema2"}) |
There was a problem hiding this comment.
Could you add:
await encrypted_client.close()
await unencrypted_client.close()
doc/changelog.rst
Outdated
|
|
||
| - Support for configuring DEK cache lifetime via the ``key_expiration_ms`` argument to | ||
| :class:`~pymongo.encryption_options.AutoEncryptionOpts`. | ||
| - Support for $lookup in CSFLE and QE.pr |
There was a problem hiding this comment.
QE.pr -> QE supported on MongoDB 8.1+.
test/asynchronous/test_encryption.py
Outdated
| ) | ||
| ) | ||
| self.assertEqual(doc, {"csfle": "csfle", "matched": [{"no_schema": "no_schema"}]}) | ||
| await encrypted_client.close() |
There was a problem hiding this comment.
Closing the clients in the tests isn't needed since they're closed at tear down anyway. The reason I asked to close the clients in asyncSetUp is because otherwise they remain open for the entire test and compete with other tasks that need to be scheduled.
There was a problem hiding this comment.
ahh okay, i see. fixed
test/asynchronous/test_encryption.py
Outdated
|
|
||
| key_doc = json_data("etc", "data", "lookup", "key-doc.json") | ||
| key_vault = await create_key_vault(encrypted_client.db.keyvault, key_doc) | ||
| self.addCleanup(key_vault.drop) |
There was a problem hiding this comment.
addCleanup -> addAsyncCleanup
Also can we use the client_context client here to drop the entire database instead of just the keyvault? This will fix the InvalidOperation: Cannot use AsyncMongoClient after close" errors (which were introduced now that we close these clients).
There was a problem hiding this comment.
Alternatively we can just leave the data there and skip the cleanup altogether.
There was a problem hiding this comment.
Ah good catch, and yes! done!
pymongo/asynchronous/encryption.py
Outdated
| :param filter: The filter to pass to listCollections. | ||
|
|
||
| :return: The first document from the listCollections command response as BSON. | ||
| :return: The all documents from the listCollections command response as BSON. |
There was a problem hiding this comment.
"The all documents" -> "All documents"
There was a problem hiding this comment.
Oop good catch, fixed!
|
I opened https://jira.mongodb.org/browse/PYTHON-5225 because I don't think those test failures are related to the work I did? But if I'm wrong, lmk! |
No description provided.