feat(mongodb): support createIndex shell command (#2187)

This commit is contained in:
onenewcode authored and GitHub committed 2026-06-30 21:34:58 +08:00
1 parent 4e012a9dd9
commit b90e4fd64e
17 files changed
+374 -18

No files matched your search

+22
View File
@@ -175,6 +175,28 @@ pub async fn mongo_aggregate_documents(
.await
}
#[tauri::command]
pub async fn mongo_create_index(
state: State<'_, Arc<AppState>>,
connection_id: String,
database: String,
collection: String,
keys_json: String,
options_json: Option<String>,
) -> Result<serde_json::Value, String> {
ensure_connection_writable(&state, &connection_id, "Create index").await?;
let name = dbx_core::mongo_ops::mongo_create_index_core(
&state,
&connection_id,
&database,
&collection,
&keys_json,
options_json.as_deref(),
)
.await?;
Ok(serde_json::json!({ "name": name }))
}
#[tauri::command]
pub async fn mongo_insert_document(
state: State<'_, Arc<AppState>>,