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

  • deno
    import { initializeApp } from "npm:[email protected]/app";
    import { deleteDoc, doc, getFirestore } from "npm:firebase/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 hugo697 399 days ago

  • deno
    import { initializeApp } from "npm:[email protected]/app";
    import { deleteDoc, doc, getFirestore } from "npm:firebase/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 admin 1034 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { initializeApp } from "npm:[email protected]/app";
    import { deleteDoc, doc, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * Deletes a document.
     */
    export async function main(
      auth: Resource<"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 adam186 1140 days ago