import { initializeApp } from "npm:firebase@9.20.0/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 497 days ago
import { initializeApp } from "npm:firebase@9.20.0/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 501 days ago
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
import { initializeApp } from "npm:firebase@9.20.0/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 606 days ago
import { Resource } from "https://deno.land/x/windmill@v1.89.0/mod.ts";
import { initializeApp } from "npm:firebase@9.20.0/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 606 days ago