Closed amitransinha closed 7 years ago
Please make sure to use the Admin Firestore types directly:
const Firestore = admin.firestore;
const db = Firestore();
At the moment, you can't mix and match the instances returned from GCloud and the Firebase Admin SDK.
Hi, I am not able to save geo point in the same format as it seen after saving it manually in the firestore document. Please have a look at my code.
const admin = require("firebase-admin"); const serviceAccount = require(process.env.FBASE_AUTH_FILE); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: process.env.dbURL }); let d = new Date(); let data = { name: 'Amit', location: new admin.firestore.GeoPoint(28.52038,77.28073), created_at: d.getTime() } setDoc = db.collection('users').doc().set(data); if (setDoc) { console.log('User added'); }
// Error which I am receiving is as follows. Error: Cannot encode type ([object Object]) to a Firestore Value