Constructor
new FirestoreClient(optionsopt)
Construct an instance of FirestoreClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. See the subsequent parameters for more details. Properties
|
- Source:
Members
(static) apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
- Source:
(static) port
The port for this API service.
- Source:
(static) scopes
The scopes needed to make gRPC calls for every method defined in this service.
- Source:
(static) servicePath
The DNS address for this API service.
- Source:
Methods
batchGetDocuments(request, optionsopt) → {Stream}
Gets multiple documents.
Documents returned by this method are not guaranteed to be returned in the same order that they were requested.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
beginTransaction(request, optionsopt) → {Promise}
Starts a new transaction.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
close()
Terminate the GRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
- Source:
commit(request, optionsopt) → {Promise}
Commits a transaction, while optionally updating documents.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
createDocument(request, optionsopt) → {Promise}
Creates a new document.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
deleteDocument(request, optionsopt) → {Promise}
Deletes a document.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
getDocument(request, optionsopt) → {Promise}
Gets a single document.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
getProjectId(callback)
Return the project ID used by this class.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
the callback to be called with the current project Id. |
- Source:
listCollectionIds(request, optionsopt) → {Promise}
Lists all the collection IDs underneath a document.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
listCollectionIdsStream(request, optionsopt) → {Stream}
Equivalent to listCollectionIds, but returns a NodeJS Stream object.
This fetches the paged responses for listCollectionIds continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
listDocuments(request, optionsopt) → {Promise}
Lists documents.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
listDocumentsStream(request, optionsopt) → {Stream}
Equivalent to listDocuments, but returns a NodeJS Stream object.
This fetches the paged responses for listDocuments continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
listen(optionsopt) → {Stream}
Listens to changes.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
rollback(request, optionsopt) → {Promise}
Rolls back a transaction.
Parameters:
Name | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
runQuery(request, optionsopt) → {Stream}
Runs a query.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
updateDocument(request, optionsopt) → {Promise}
Updates or inserts a document.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source:
write(optionsopt) → {Stream}
Streams batches of document updates and deletes, in order.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
- Source: