DocumentReference | JavaScript SDK | Node.js (client) API reference | Firebase
Type parameters
-
T
Index
Constructors
Private constructor
- new
Document Reference ( ) : DocumentReference -
Returns DocumentReference
Properties
firestore
id
id: string
parent
path
path: string
Methods
collection
- collection ( collectionPath : string ) : CollectionReference < DocumentData >
-
Parameters
-
collectionPath: string
Returns CollectionReference<DocumentData>
The
CollectionReferenceinstance. -
delete
- delete ( ) : Promise < void >
-
Returns Promise<void>
A Promise resolved once the document has been successfully deleted from the backend (Note that it won't resolve while you're offline).
get
- get ( options ? : GetOptions ) : Promise < DocumentSnapshot < T > >
-
Parameters
-
Optional options: GetOptions
Returns Promise<DocumentSnapshot<T>>
A Promise resolved with a DocumentSnapshot containing the current document contents.
-
isEqual
- is
Equal ( other : DocumentReference < T > ) : boolean -
Parameters
-
other: DocumentReference<T>
Returns boolean
true if this
DocumentReferenceis equal to the provided one. -
onSnapshot
- on
Snapshot ( observer : { complete ?: ( ) => void ; error ?: ( error : FirestoreError ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void } ) : ( ) => void -
Parameters
-
observer: { complete?: () => void; error?: (error: FirestoreError) => void; next?: (snapshot: DocumentSnapshot<T>) => void }
-
Optional complete?: () => void
-
- (): void
-
Returns void
-
-
Optional error?: (error: FirestoreError) => void
-
- (error: FirestoreError): void
-
Parameters
-
error: FirestoreError
Returns void
-
-
-
Optional next?: (snapshot: DocumentSnapshot<T>) => void
-
- (snapshot: DocumentSnapshot<T>): void
-
Parameters
-
snapshot: DocumentSnapshot<T>
Returns void
-
-
-
Returns () => void
An unsubscribe function that can be called to cancel the snapshot listener.
-
- (): void
-
Returns void
-
- on
Snapshot ( options : SnapshotListenOptions , observer : { complete ?: ( ) => void ; error ?: ( error : FirestoreError ) => void ; next ?: ( snapshot : DocumentSnapshot < T > ) => void } ) : ( ) => void -
Parameters
-
options: SnapshotListenOptions
-
observer: { complete?: () => void; error?: (error: FirestoreError) => void; next?: (snapshot: DocumentSnapshot<T>) => void }
-
Optional complete?: () => void
-
- (): void
-
Returns void
-
-
Optional error?: (error: FirestoreError) => void
-
- (error: FirestoreError): void
-
Parameters
-
error: FirestoreError
Returns void
-
-
-
Optional next?: (snapshot: DocumentSnapshot<T>) => void
-
- (snapshot: DocumentSnapshot<T>): void
-
Parameters
-
snapshot: DocumentSnapshot<T>
Returns void
-
-
-
Returns () => void
An unsubscribe function that can be called to cancel the snapshot listener.
-
- (): void
-
Returns void
-
- on
Snapshot ( onNext : ( snapshot : DocumentSnapshot < T > ) => void , onError ? : ( error : FirestoreError ) => void , onCompletion ? : ( ) => void ) : ( ) => void -
Parameters
-
onNext: (snapshot: DocumentSnapshot<T>) => void
-
- (snapshot: DocumentSnapshot<T>): void
-
Parameters
-
snapshot: DocumentSnapshot<T>
Returns void
-
-
-
Optional onError: (error: FirestoreError) => void
-
- (error: FirestoreError): void
-
Parameters
-
error: FirestoreError
Returns void
-
-
-
Optional onCompletion: () => void
-
- (): void
-
Returns void
-
Returns () => void
An unsubscribe function that can be called to cancel the snapshot listener.
-
- (): void
-
Returns void
-
- on
Snapshot ( options : SnapshotListenOptions , onNext : ( snapshot : DocumentSnapshot < T > ) => void , onError ? : ( error : FirestoreError ) => void , onCompletion ? : ( ) => void ) : ( ) => void -
Parameters
-
options: SnapshotListenOptions
-
onNext: (snapshot: DocumentSnapshot<T>) => void
-
- (snapshot: DocumentSnapshot<T>): void
-
Parameters
-
snapshot: DocumentSnapshot<T>
Returns void
-
-
-
Optional onError: (error: FirestoreError) => void
-
- (error: FirestoreError): void
-
Parameters
-
error: FirestoreError
Returns void
-
-
-
Optional onCompletion: () => void
-
- (): void
-
Returns void
-
Returns () => void
An unsubscribe function that can be called to cancel the snapshot listener.
-
- (): void
-
Returns void
-
set
- set ( data : Partial < T > , options : SetOptions ) : Promise < void >
-
Parameters
-
data: Partial<T>
-
options: SetOptions
Returns Promise<void>
A Promise resolved once the data has been successfully written to the backend (Note that it won't resolve while you're offline).
-
- set ( data : T ) : Promise < void >
-
Parameters
-
data: T
Returns Promise<void>
A Promise resolved once the data has been successfully written to the backend (Note that it won't resolve while you're offline).
-
update
- update ( data : UpdateData ) : Promise < void >
-
Parameters
-
data: UpdateData
Returns Promise<void>
A Promise resolved once the data has been successfully written to the backend (Note that it won't resolve while you're offline).
-
- update ( field : string | FieldPath , value : any , ... moreFieldsAndValues : any [] ) : Promise < void >
-
Parameters
-
field: string | FieldPath
-
value: any
-
Rest ...moreFieldsAndValues: any[]
Returns Promise<void>
A Promise resolved once the data has been successfully written to the backend (Note that it won't resolve while you're offline).
-
withConverter
- with
Converter ( converter : null ) : DocumentReference < DocumentData > -
Parameters
-
converter: null
Returns DocumentReference<DocumentData>
A DocumentReference that uses the provided converter.
-
- with
Converter < U > ( converter : FirestoreDataConverter < U > ) : DocumentReference < U > -
Type parameters
-
U
Parameters
-
converter: FirestoreDataConverter<U>
Returns DocumentReference<U>
A DocumentReference that uses the provided converter.
-