Skip to content

Commit 89ee7e5

Browse files
committed
add sync method
1 parent e35dbbf commit 89ee7e5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/sync/db.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,28 @@ impl Database {
219219
))
220220
}
221221

222+
/// Creates a new collection with encrypted fields, automatically creating new data encryption
223+
/// keys when needed based on the configured [`CreateCollectionOptions::encrypted_fields`].
224+
///
225+
/// Returns the potentially updated `encrypted_fields` along with status, as keys may have been
226+
/// created even when a failure occurs.
227+
///
228+
/// Does not affect any auto encryption settings on existing MongoClients that are already
229+
/// configured with auto encryption.
230+
#[cfg(feature = "in-use-encryption-unstable")]
231+
pub fn create_encrypted_collection(
232+
&self,
233+
ce: &crate::client_encryption::ClientEncryption,
234+
name: impl AsRef<str>,
235+
options: impl Into<Option<CreateCollectionOptions>>,
236+
master_key: crate::client_encryption::MasterKey,
237+
) -> (Document, Result<()>) {
238+
runtime::block_on(
239+
self.async_database
240+
.create_encrypted_collection(ce, name, options, master_key),
241+
)
242+
}
243+
222244
/// Runs a database-level command.
223245
///
224246
/// Note that no inspection is done on `doc`, so the command will not use the database's default

0 commit comments

Comments
 (0)