-
Notifications
You must be signed in to change notification settings - Fork 110
Firestore Method Documentation
To get an instance of the Firestore object for your project from this library, call
var firestore = FirestoreApp.getFirestore(email, key, projectId);
This page documents the methods that belong to the Firestore object (referred to with firestore
).
Create a document with the given ID and fields.
Returns: the Document object written to Firestore
Parameter name | Type | Description |
---|---|---|
documentId |
string | the ID of the document in Firestore |
path |
string | the path where the document will be written |
fields |
object | the document's fields as a JSON object |
Create a document with the given fields and an auto-generated ID.
Returns: the Document object written to Firestore
Parameter name | Type | Description |
---|---|---|
path |
string | the path where the document will be written |
fields |
object | the document's fields as a JSON object |
Update/patch a document at the given path with new fields.
Returns: the Document object written to Firestore
Parameter name | Type | Description |
---|---|---|
path |
string | the path of the document to update |
fields |
object | the new fields to write to the document |
Delete the Firestore document at the given path. Note: this deletes ONLY this document, and not any subcollections.
Returns: the JSON response from the DELETE request.
Parameter name | Type | Description |
---|---|---|
pathToDocument |
string | the path of the document to delete |
Get fields from a document.
Returns: an object mapping the document's fields to its values
Parameter name | Type | Description |
---|---|---|
path |
string | the path to the document |
Get a list of all documents (in field-value JSON format) in a collection.
Returns: an array of the documents in the collection
Parameter name | Type | Description |
---|---|---|
pathToCollection |
string | the path to the collection |
Get a list of all IDs of the documents in a collection.
Returns: an array of IDs of the documents in the collection
Parameter name | Type | Description |
---|---|---|
pathToCollection |
string | the path to the collection |