MongoDB 删除记录

本章将讨论 Mongo DB 删除记录操作

pub async fn del(State(state): State<ArcAppState>, Path(id): Path<String>) -> Result<Json<u64>> {
    let n = state.note_collect().delete_one(doc! {"_id": &id}).await?;
    Ok(Json(n.deleted_count))
}

测试:

要查看完整内容,请先登录