UNPKG

@typed-firestore/server

Version:

Elegant, typed abstractions for Firestore in server environments

15 lines (12 loc) 310 B
import { CollectionReference, type DocumentData, type WithFieldValue, } from "firebase-admin/firestore"; export async function addDocument<T extends DocumentData>( ref: CollectionReference<T>, data: WithFieldValue<T> ): Promise<string> { const docRef = await ref.add(data); return docRef.id; }