Skip to content

Commit e25357e

Browse files
committed
Use the right database; rename some vars
1 parent d2ddf4e commit e25357e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

django_mongodb_backend/schema.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,14 @@ def _create_collection(self, model):
425425
create an encrypted collection with the encrypted fields map.
426426
"""
427427

428+
db = self.get_database()
428429
if not hasattr(model, "encrypted"):
429-
self.get_database().create_collection(model._meta.db_table)
430+
db.create_collection(model._meta.db_table)
430431
else:
431432
client = self.connection.connection
432-
client_encryption = get_client_encryption(client)
433-
client_encryption.create_encrypted_collection(
434-
client.database,
433+
ce = get_client_encryption(client)
434+
ce.create_encrypted_collection(
435+
db,
435436
model._meta.db_table,
436437
self._get_encrypted_fields_map(model),
437438
"local", # TODO: KMS provider should be configurable

0 commit comments

Comments
 (0)