Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shell-api): adds createEncryptedCollection on Database and ClientEncryption #1416

Merged
merged 13 commits into from
Feb 27, 2023

Conversation

himanshusinghs
Copy link
Contributor

@himanshusinghs himanshusinghs commented Feb 23, 2023

Closes

MONGOSH-1316

Description:

This PR exposes a helper method called createEncryptedCollection provided by libmongocrypt to create an encrypted collection without explicitly specifying the data encryption keys for every encrypted fields.

The heavy lifting is already done by libmongocrypt and here we only provide an interface for users to interact with this functionality.

Usage:

With this change, users will be able to create an encrypted collection using any of the following forms:

  • db.createEncryptedCollection(collectionName, createCollectionOptions), or
  • db.getMongo().getClientEncryption().createEncryptedCollection(dbName, collectionName, createCollectionOptions)

Assuming that the underlying connection was initiated with relevant FLE options.

Returns:

Originally libmongocrypt's createEncryptedCollection returns the native Collection object alongside a list of encrypted fields but here we augment the return type and instead we return the mongosh Collection object alongside the provided list of encrypted fields. This was done to make sure that users will be able to tail expected mongosh collection methods on the returned collection.

- moved encryptedCollection to ServiceProvider
- no additional assertions
packages/cli-repl/test/e2e-fle.spec.ts Outdated Show resolved Hide resolved
packages/cli-repl/test/e2e-fle.spec.ts Outdated Show resolved Hide resolved
packages/shell-api/src/field-level-encryption.ts Outdated Show resolved Hide resolved
@himanshusinghs himanshusinghs self-assigned this Feb 23, 2023
himanshusinghs and others added 3 commits February 24, 2023 13:41
Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
Co-authored-by: Anna Henningsen <anna.henningsen@mongodb.com>
@himanshusinghs himanshusinghs merged commit 86c8bc8 into main Feb 27, 2023
@himanshusinghs himanshusinghs deleted the MONGOSH-1316-automatically-create-encryption-keys branch February 27, 2023 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants