Delete Collection

Script appwrite Verified

by adam186 ยท 4/17/2023

The script

Submitted by hugo989 Bun
Verified 1 day ago
1
import { Client, Databases } 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
) {
14
  const client = new Client()
15
    .setEndpoint(auth.endpoint)
16
    .setProject(auth.project)
17
    .setKey(auth.key);
18
  const db = new Databases(client);
19

20
  return await db.deleteCollection(database_id, collection_id);
21
}
22

Other submissions
  • Submitted by adam186 Deno
    Created 393 days ago
    1
    import { Client, Databases } from "https://deno.land/x/[email protected]/mod.ts";
    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
    ) {
    14
      const client = new Client()
    15
        .setEndpoint(auth.endpoint)
    16
        .setProject(auth.project)
    17
        .setKey(auth.key);
    18
      const db = new Databases(client);
    19
    
    
    20
      return await db.deleteCollection(database_id, collection_id);
    21
    }
    22