Skip to content

Instantly share code, notes, and snippets.

@Jviejo
Created November 2, 2021 13:10
Show Gist options
  • Save Jviejo/5da7fafcb4653d3d5eb8188b306b3682 to your computer and use it in GitHub Desktop.
Save Jviejo/5da7fafcb4653d3d5eb8188b306b3682 to your computer and use it in GitHub Desktop.
// Import only what you need
const admin = require('firebase-admin');
process.env['FIRESTORE_EMULATOR_HOST'] = 'localhost:8081';
var serviceAccount = require('./curso_inicio.json')
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
projectId: "curso-de-inicio",
});
var database = admin.firestore();
(async () => {
const docRef = database.collection('campo').doc('alovelace122/campo/12');
await docRef.set({
first: 'Ada modif11',
last: 'Lovelace122',
born: 18152
});
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment