Firebase.Firestore.CollectionReference

A reference to a collection in aFirestore database.

Summary

The existence of this object does not imply that the collection currently exists in storage.

ACollectionReference can be used for adding documents, getting document references, and querying for documents (using the methods inherited fromQuery).

Inheritance

Inherits from:Firebase.Firestore.Query, IEquatable< CollectionReference >

Properties

Parent
The parent document, or null if this is a root collection.

Public attributes

Id => Proxy.id()
string
The final part of the complete collection path; this is the identity of the collection relative to its parent document.
Path => Proxy.path()
string
The complete collection path, including project and database ID.

Public functions

AddAsync(object documentData)
Asynchronously creates a document with the given data in this collection.
Document()
Creates aDocumentReference for a direct child document of this collection with a random ID.
Document(string path)
Creates aDocumentReference for a child document of this reference.
Equals(object obj)
override bool
Equals(CollectionReference other)
bool
GetHashCode()
override int
ToString()
override string

Properties

Parent

DocumentReferenceParent

The parent document, or null if this is a root collection.

Public attributes

Id

stringId=>Proxy.id()

The final part of the complete collection path; this is the identity of the collection relative to its parent document.

Path

stringPath=>Proxy.path()

The complete collection path, including project and database ID.

Public functions

AddAsync

Task<DocumentReference>AddAsync(objectdocumentData)

Asynchronously creates a document with the given data in this collection.

The document has a randomly generated ID.

Details
Parameters
documentData
The data for the document. Must not be null.
Returns
The reference for the newly-created document.

Document

DocumentReferenceDocument()

Creates aDocumentReference for a direct child document of this collection with a random ID.

This performs no server-side operations; it only generates the appropriateDocumentReference.

Details
Returns
ADocumentReference to a child document of this collection with a random ID.

Document

DocumentReferenceDocument(stringpath)

Creates aDocumentReference for a child document of this reference.

Details
Parameters
path
The path to the document, relative to this collection. Must not be null, and must contain an odd number of slash-separated path elements.
Returns
ADocumentReference for the specified document.

Equals

overrideboolEquals(objectobj)

Equals

boolEquals(CollectionReferenceother)

GetHashCode

overrideintGetHashCode()

ToString

overridestringToString()

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-07-27 UTC.