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

DocumentReference

A DocumentReference refers to a document location in a Firestore database and can be used to write, read, or listen to the location. The document at the referenced location may or may not exist.

class DocumentReference<AppModelType = DocumentData, DbModelType extends DocumentData = DocumentData> {
private constructor();
readonly converter: FirestoreDataConverter<AppModelType, DbModelType> | null;
readonly firestore: Firestore;
get id(): string;
get path(): string;
get parent(): CollectionReference<AppModelType, DbModelType>;
readonly type: string;
 
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>;
withConverter(converter: null): DocumentReference<DocumentData, DocumentData>;
}

§Type Parameters

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

§Constructors

§
new DocumentReference() private
[src]

§Properties

§
converter: FirestoreDataConverter<AppModelType, DbModelType> | null
[src]

If provided, the FirestoreDataConverter associated with this instance.

§
firestore: Firestore
[src]

The Firestore instance the document is in. This is useful for performing transactions, for example.

§
id: string readonly
[src]

The document's identifier within its collection.

§
path: string readonly
[src]

A string representing the path of the referenced document (relative to the root of the database).

§
parent: CollectionReference<AppModelType, DbModelType> readonly
[src]

The collection this DocumentReference belongs to.

§
type: string
[src]

The type of this Firestore reference.

§Methods

§
withConverter<NewAppModelType, NewDbModelType extends DocumentData = DocumentData>(converter: FirestoreDataConverter<NewAppModelType, NewDbModelType>): DocumentReference<NewAppModelType, NewDbModelType>
[src]

Applies a custom data converter to this DocumentReference, allowing you to use your own custom model objects with Firestore. When you call {@link

@param converter
  • Converts objects to and from Firestore.
@return

A DocumentReference that uses the provided converter.

withConverter(converter: null): DocumentReference<DocumentData, DocumentData>
[src]

Removes the current converter.

@param converter
  • null removes the current converter.
@return

A DocumentReference<DocumentData, DocumentData> that does not use a converter.