Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

addDoc

Add a new document to specified CollectionReference with the given data, assigning it a document ID automatically.

function addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>;
§
addDoc<AppModelType, DbModelType extends DocumentData>(reference: CollectionReference<AppModelType, DbModelType>, data: WithFieldValue<AppModelType>): Promise<DocumentReference<AppModelType, DbModelType>>
[src]

§Type Parameters

§
AppModelType
[src]
§
DbModelType extends DocumentData
[src]

§Parameters

§
reference: CollectionReference<AppModelType, DbModelType>
[src]
  • A reference to the collection to add this document to.
§
data: WithFieldValue<AppModelType>
[src]
  • An Object containing the data for the new document.

§Return Type

§
Promise<DocumentReference<AppModelType, DbModelType>>
[src]

A Promise resolved with a DocumentReference pointing to the newly created document after it has been written to the backend (Note that it won't resolve while you're offline).