A Google Apps Script library for accessing Google Cloud Firestore.
Document.path
property to get the local path of a document from the database. Thanks @juliusn for this! #99To utilize the new version:
Resources
> Libraries...
from the menu.33
next to FirestoreApp
(or whatever name you use locally).Updates to the Tests file requires a new version for Live Tests to be runnable.
To utilize the new version:
Resources
> Libraries...
from the menu.32
next to FirestoreApp
.To utilize the new version:
Resources
> Libraries...
from the menu.31
next to FirestoreApp
..getDocuments
and .query
didn't return Document.obj
data. Thanks @tricknotes for the nice find! #94.gitattributes
to handle line endings. Again, thanks @tricknotes for bringing this up. #93Thanks to @tricknotes for these quick finds!
To utilize the new version:
Resources
> Libraries...
from the menu.30
next to FirestoreApp
.The new badges from v27 were nice, but the Testing badge wouldn't display. This is because GitHub anonymizes images on the README pages.
This is great, however the service times out after 3 seconds, and the image is dynamically generated after running the tests.. and this took more than 3 seconds.
I took the liberty of running the tests every hour via. Script Trigger and caching the results. This should allow the badge to pull up the cached results and load them onto the README.
No library update is required for this.
Date
objects created would not be recognized as a Date
object. #86Thanks to all that brought up the issue and @rielzzapps for narrowing it down.
To utilize the new version:
Resources
> Libraries...
from the menu.28
next to FirestoreApp
.Select
, Where
, OrderBy
, Limit
, Offset
, Range
).Document
or Document[]
types directly from Firebase. Use document.obj
to extract the raw object.
document.createTime
and document.updateTime
will remain as timestamped strings. However document.created
, document.updated
, and document.read
are Date
objects.To utilize the new version:
Resources
> Libraries...
from the menu.27
next to FirestoreApp
.Your project runtime (V8 or Rhino) is independent of this library and they do not have to align for things to run.
The Firebase API's PATCH endpoint to update documents does not handle the creation of documents with dynamic names.
This issue has been solved in v26, and now correctly creates documents when a document name is omitted from the path
in .createDocument(path, fields)
function.
Collections and documents with special characters are still created properly.
v25 has been removed from the Apps Script Library.
Thanks @shoumik1 for raising this issue. #85
This release allows for virtually any Collection, Document, and Field names can be utilized. International characters and most symbols are supported.
Since API projects.databases.documents/createDocument does not properly handle escaped document names, document creation is handled by the patch endpoint.
Field names have been internally wrapped with the backtick (`
) character as recommended.
If any characters are found to not be handled properly, please create an issue with the character(s) to address.
The Firebase REST API has been updated with 3 available versions. This application originally supported "v1beta1", and now supports "v1beta2" and "v1".
FirestoreApp.getFirestore(email, key, projectId, "v1");
.query().filter()
operators: "IN" and "Contains_Any" (case-insensitive).The .getDocuments()
function now allows for an optional second parameter to only select specific documents by name.
const someDocuments = firestore.getDocuments("FirstCollection", ["Doc1", "Doc2", "Doc3"]);
Thanks to @ken-prayogo for the feature request. #79