fix(mongodb): support compass shell commands

This commit is contained in:
t8y2 committed 2026-06-01 16:24:31 +08:00
1 parent a0dcee51bc
commit a87b8ece31
10 files changed
+512 -10

No files matched your search

+46
View File
@@ -76,6 +76,17 @@ pub async fn mongo_insert_document(
dbx_core::mongo_ops::mongo_insert_document_core(&state, &connection_id, &database, &collection, &doc_json).await
}
#[tauri::command]
pub async fn mongo_insert_documents(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
collection: String,
docs_json: String,
) -> Result<u64, String> {
dbx_core::mongo_ops::mongo_insert_documents_core(&state, &connection_id, &database, &collection, &docs_json).await
}
#[tauri::command]
pub async fn mongo_update_document(
state: State<'_, Arc<AppState>>,
@@ -89,6 +100,28 @@ pub async fn mongo_update_document(
.await
}
#[tauri::command]
pub async fn mongo_update_documents(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
collection: String,
filter_json: String,
update_json: String,
many: bool,
) -> Result<u64, String> {
dbx_core::mongo_ops::mongo_update_documents_core(
&state,
&connection_id,
&database,
&collection,
&filter_json,
&update_json,
many,
)
.await
}
#[tauri::command]
pub async fn mongo_delete_document(
state: State<'_, Arc<AppState>>,
@@ -99,3 +132,16 @@ pub async fn mongo_delete_document(
) -> Result<u64, String> {
dbx_core::mongo_ops::mongo_delete_document_core(&state, &connection_id, &database, &collection, &id).await
}
#[tauri::command]
pub async fn mongo_delete_documents(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
collection: String,
filter_json: String,
many: bool,
) -> Result<u64, String> {
dbx_core::mongo_ops::mongo_delete_documents_core(&state, &connection_id, &database, &collection, &filter_json, many)
.await
}