In Firebase, you can get all the keys of an
Object very easily. The thing that you should note is that a dictionary is just an
Object in Firestore.
All the custom
To get all keys of an object, you can simply use the
Object.keys() method that is available for all the
But, of course, you first have to get the
Object from Firestore to read it locally. In fact, all the operations in
Objects (and by extension, Arrays) can only be done locally in order to modify them.
This simply means that in order to mutate an
Object, you first have to read it from the Cloud Firestore DB. Perform your
update/delete operation and then overwrite that value to the DB.
Let’s suppose that you have the following object in your Firestore Database.
This object has two keys in it. The
startTime and the
In Cloud Functions, you can get all the keys of this
Object by using the Admin SDK. Here’s how the code will look like:
const functions = require('firebase-functions');
You can see, this works the same way as it does for plain JS
You’ll obviously need to customize this code based on your requirement, but the gist of will remain the same.