Edits history of script submission #22364 for ' Delete Document (firebase)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { initializeApp } from "[email protected]/app";
    import { deleteDoc, doc, getFirestore } from "[email protected]/firestore/lite";
    
    /**
     * Deletes a document.
     */
    type Firebase = {
      apiKey: string;
      authDomain: string;
      projectId: string;
      storageBucket: string;
      messagingSenderId: string;
      appId: string;
      measurementId: string;
    };
    export async function main(
      auth: Firebase,
      collection_id: string,
      document_path: string[],
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const docRef = doc(store, collection_id, ...document_path);
      await deleteDoc(docRef);
    }
    

    Submitted by hugo989 6 days ago