Delete Document

Script appwrite Verified

by adam186 ยท 4/18/2023

The script

Submitted by hugo989 Bun
Verified 1 day ago
1
import { Client, Databases, ID } from "[email protected]";
2

3
type Appwrite = {
4
  endpoint: string;
5
  project: string;
6
  key: string;
7
  self_signed: boolean;
8
};
9
export async function main(
10
  auth: Appwrite,
11
  database_id: string,
12
  collection_id: string,
13
  document_id: string,
14
) {
15
  const client = new Client()
16
    .setEndpoint(auth.endpoint)
17
    .setProject(auth.project)
18
    .setKey(auth.key);
19
  const db = new Databases(client);
20

21
  return await db.deleteDocument(database_id, collection_id, document_id);
22
}
23

Other submissions
  • Submitted by adam186 Deno
    Created 393 days ago
    1
    import {
    2
      Client,
    3
      Databases,
    4
      ID,
    5
    } from "https://deno.land/x/[email protected]/mod.ts";
    6
    
    
    7
    type Appwrite = {
    8
      endpoint: string;
    9
      project: string;
    10
      key: string;
    11
      self_signed: boolean;
    12
    };
    13
    export async function main(
    14
      auth: Appwrite,
    15
      database_id: string,
    16
      collection_id: string,
    17
      document_id: string,
    18
    ) {
    19
      const client = new Client()
    20
        .setEndpoint(auth.endpoint)
    21
        .setProject(auth.project)
    22
        .setKey(auth.key);
    23
      const db = new Databases(client);
    24
    
    
    25
      return await db.deleteDocument(database_id, collection_id, document_id);
    26
    }
    27