Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Created by Yi Hong
Created on Feb 25, 2026

Allow enabling/disabling automatic CSFLE encryption/decryption on per-collection/database level in Python SDK

What problem are you trying to solve?

Focus on the what and why of the need you have, not the how you'd like it solved.

So far, we can only specify whether automatic encryption/decryption is on on a MongoClient, and all operations there will follow the settings. I would like to only enable automatic encryption/decryption on a specific collection/database/operation.

What would you like to see happen?

Describe the desired outcome or enhancement.

get_database and get_collection should perhaps accept a AutoEncryptionOptions. Each collection operation (like find_one) should perhaps accept parameters like enable_automatic_encryption or enable_automatic_decryption that overrides collection/database/client level settings.

Why is this important to you or your team?

Explain how the request adds value or solves a business need.

Many of our operations need to be in a cross-collection transaction. In the Python SDK, transactions are initiated from ClientSession, and a session cannot be used between two MongoClients. This means that it is impossible to issue one command with auto encryption/decryption and another without and have both in the same transaction, as they require two clients.

What steps, if any, are you taking today to manage this problem?

We are circumventing auto encryption/decryption and using manual encryption/decryption only, which is very troublesome and error-prone.