Add Document

addDocumentFirebase

  • Description: Menambahkan dokumen baru ke koleksi Firestore.

  • Parameters:

    • collectionName: Nama koleksi Firestore.

    • data: Objek data yang ingin ditambahkan sebagai dokumen baru.

    • companyId: ID perusahaan terkait (opsional).

  • Example Call:

const collectionName = 'CollectionName';
const data = {
  field1: 'Value1',
  field2: 'Value2',
  // Add more fields as needed
};

try {
  const docID = await addDocumentFirebase(collectionName, data, companyId);
  console.log('New Document ID:', docID);
} catch (error) {
  console.log('Error:', error);
}

Last updated