FirestoreGoogleAppsScript Versions Save

A Google Apps Script library for accessing Google Cloud Firestore.

v23

4 years ago

This release comes after a long break.

  • Timestamp fields should no longer have issues when updating documents with a Date object. Thanks @Spencer-Easton! #71
  • Fixed issues with Apps Script not being able to handle Timestamps with microseconds. #42
  • Added a Query Range function which is a shorthand for .offset and .range functions. #77
var db = getFirestore(email, key, project);
var results10_15 = db.query(path).range(10, 15).execute();

Which is equivalent to:

var db = getFirestore(email, key, project);
var results10_15 = db.query(path).offset(10).limit(5).execute();

Breaking Changes

  • When retreiving documents the createTime and updateTime document properties are JS Date objects and not Timestamp Strings.

v22

5 years ago

Now the update function includes an extra boolean parameter, mask. When true, the update will apply as a mask. So if your document looks like this:

{ number: 1, text: "Hello" }

and you call update with mask = true with this object as your mask:

{ number: 2 } 

then the number field will be updated, but the text field will not. The resulting document will be

{ number: 2, text: "Hello" }

Thanks to @webstermath for this feature!

v21

5 years ago

This version adds a new operator for querying. You can now query for documents with an array field that contains some value. For example, say you have a collection "My Collection" of documents that each have an array field called numbers. To find all documents with 42 in their numbers array, you can now query like this:

firestore.query("My Collection").where("numbers", "contains", 42).execute();

Thanks to @joao-azevedo-hydradev for this addition!

v19

5 years ago

This release is a hotfix for a bug in v18, where our isNaN check said that any non-number type was NaN. Now the check only checks for NaN if the value is of type number.

v18

5 years ago

This version merges in another nice PR from @LaughDonor (#33), which the query method where(field, "==", null) to be equivalent to the query method where(field, "null") (similarly for undefined, NaN).

v17

5 years ago

Before this version, an empty array in a document would cause an error in the library. No more! Thanks for finding the issue @adyscorpius, and thanks for the fix @LaughDonor.

v14

6 years ago

Versions 8 through 14 are all essentially the same — I was just getting used to using the clasp library and so I accidentally deployed a few times with the wrong release description :)

v16

6 years ago

This version adds support for querying within collection! It also adds support for all data types you can store in Firestore (including timestamps, geopoints, and references to other documents).

See documentation here.

Huge thanks to @LaughDonor for the great work in this release.