Last active
January 9, 2020 15:23
-
-
Save grant/22e37ee1534271208d83007aba69db39 to your computer and use it in GitHub Desktop.
Cloud Run Storage – Firestore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a Firebase client | |
const admin = require('firebase-admin'); | |
admin.initializeApp({ | |
credential: admin.credential.applicationDefault() | |
}); | |
const db = admin.firestore(); | |
async function uploadDoc(req, res) { | |
// Create a reference to the shoes doc. | |
let shoesDoc = db.collection('products').doc('shoes'); | |
// Add a shoe | |
shoesDoc.set({ | |
name: 'gshoe', | |
size: 11.5, | |
colors: ['blue', 'red', 'yellow', 'green'] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment