Skip to content

Instantly share code, notes, and snippets.

View rayfarer's full-sized avatar
🎯
Focusing

Sean Ray rayfarer

🎯
Focusing
View GitHub Profile
@rayfarer
rayfarer / script.js
Created April 1, 2018 15:47
Add Timestamp When Document Created Firestore
/*
Using Cloud Functions, here's what I've come up with for anyone who wants to
add a timestamp field in a Firestore document. You need to have the Firebase Admin SDK installed in
addition to the general setup for Cloud Functions as detailed in the Firebase documentation.
*/
const functions = require('firebase-functions');
// The Firebase Admin SDK to access the Firebase Realtime Database.
const admin = require('firebase-admin');