Edits history of script submission #358 for ' Create Document (firebase)'

  • deno
    import { initializeApp } from "npm:[email protected]/app";
    import { addDoc, collection, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * Learn more about adding documents at
     * https://firebase.google.com/docs/firestore/manage-data/add-data
     *
     * @returns The ID of the new 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: Record<string, any>,
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const colRef = collection(store, collection_id);
      const res = await addDoc(colRef, document);
    
      return res.id;
    }
    

    Submitted by hugo697 399 days ago

  • deno
    import { initializeApp } from "npm:[email protected]/app";
    import { addDoc, collection, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * Learn more about adding documents at
     * https://firebase.google.com/docs/firestore/manage-data/add-data
     *
     * @returns The ID of the new 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: Record<string, any>,
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const colRef = collection(store, collection_id);
      const res = await addDoc(colRef, document);
    
      return res.id;
    }
    

    Submitted by admin 1031 days ago

  • deno
    import { initializeApp } from "npm:[email protected]/app";
    import { addDoc, collection, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * Learn more about adding documents at
     * https://firebase.google.com/docs/firestore/manage-data/add-data
     * 
     * @returns The ID of the new 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: Record<string, any>,
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const colRef = collection(store, collection_id);
      const res = await addDoc(colRef, document);
    
      return res.id;
    }
    

    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 { addDoc, collection, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * Learn more about adding documents at
     * https://firebase.google.com/docs/firestore/manage-data/add-data
     * 
     * @returns The ID of the new document.
     */
    export async function main(
      auth: Resource<"firebase">,
      collection_id: string,
      document: Record<string, any>,
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const colRef = collection(store, collection_id);
      const res = await addDoc(colRef, document);
    
      return res.id;
    }
    

    Submitted by adam186 1140 days ago

  • deno
    import { Resource } from "https://deno.land/x/[email protected]/mod.ts";
    import { initializeApp } from "npm:[email protected]/app";
    import { addDoc, collection, getFirestore } from "npm:firebase/firestore/lite";
    
    /**
     * @returns The ID of the new document.
     */
    export async function main(
      auth: Resource<"firebase">,
      collection_id: string,
      document: Record<string, any>,
    ) {
      const app = initializeApp(auth);
      const store = getFirestore(app);
    
      const colRef = collection(store, collection_id);
      const res = await addDoc(colRef, document);
    
      return res.id;
    }
    

    Submitted by adam186 1140 days ago