For example here is my firebase screenshot https://i.stack.imgur.com/MkCQV.png and I am able to run schedule function and update one document field as shown in below code but in this case I have manually written the id in code. How do you update it for all the users?
Image link of Firestore data I am trying to update to better understand https://i.stack.imgur.com/MkCQV.png and it's code below which I have used to update. I am not able to figure out how do I do for all users as in current code I am only able to do it manually by specifying id.
database.doc("user_signups/334g6yN0iskS8qXu2boh")
const functions = require("firebase-functions");
// The Firebase Admin SDK to access Firestore.
const admin = require("firebase-admin");
admin.initializeApp();
const database = admin.firestore();
exports.scheduledFunction = functions.pubsub.schedule("5 4 * * * ").onRun(async () => {
// console.log('starting');
database.doc("user_signups/334g6yN0iskS8qXu2boh").update({
"lastLogin": admin.firestore.Timestamp.now(),
});
console.log("This will be run every 1 minutes!");
});