feat(mongodb): support bulkWrite

This commit is contained in:
Loc Nguyen authored and GitHub committed 2026-09-17 12:54:21 +08:00
1 parent 3f3c21aae9
commit f78dc1ba16
25 files changed
+1089 -18

No files matched your search

+19
View File
@@ -1860,6 +1860,25 @@ impl DbxBackend for WebBackend {
.map_err(|error| format!("Invalid MongoDB insert response: {error}"))?;
Ok(affected_query_result(affected_rows_from_value(&value)))
}
MongoCommand::BulkWrite { collection, operations, options } => {
let result: dbx_core::db::mongo_driver::MongoBulkWriteResult = self
.request(
reqwest::Method::POST,
"/api/mongo/bulk-write",
Some(json!({
"connectionId": connection_id,
"database": database,
"collection": collection,
"operationsJson": operations,
"optionsJson": options,
})),
)
.await?
.json()
.await
.map_err(|error| format!("Invalid MongoDB bulkWrite response: {error}"))?;
Ok(dbx_core::mongo_ops::mongo_bulk_write_query_result(&result))
}
MongoCommand::Replace { collection, filter, replacement, options } => {
let value: Value = self
.request(