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

CollectionReference

A CollectionReference object can be used for adding documents, getting document references, and querying for documents (using {@link (query:1)}).

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

§Type Parameters

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

§Extends

§
Query<AppModelType, DbModelType>
[src]

§Constructors

§
new CollectionReference() private
[src]

§Properties

§
id: string readonly
[src]

The collection's identifier.

§
path: string readonly
[src]

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

§

A reference to the containing DocumentReference if this is a subcollection. If this isn't a subcollection, the reference is null.

§
type: string
[src]

The type of this Firestore reference.

§Methods

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

Applies a custom data converter to this CollectionReference, allowing you to use your own custom model objects with Firestore. When you call addDoc with the returned CollectionReference instance, the provided converter will convert between Firestore data of type NewDbModelType and your custom type NewAppModelType.

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

A CollectionReference that uses the provided converter.

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

Removes the current converter.

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

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