我想使用这个set(...)
功能,但是 Firebase-Log 说这个功能不可用。
Firebase-Cloud-Function 日志:
“TypeError:GeoPostLocations.set 不是 database.collection.doc.collection.doc.set.then.result 中的函数”
const functions = require('firebase-functions');
const functions = require('firebase-functions');
var admin = require('firebase-admin');
var serviceAccount = require('./serviceAccountKey.json');
var GeoFirestore = require('geofirestore').GeoFirestore;
const database = admin.firestore();
const geofirestore = new GeoFirestore(database);
const GeoPostLocations = geofirestore.collection('PostLocations');
在我的函数中,我执行以下代码:
return GeoPostLocations.set("DummyIDForTest", [50.312312312, 5.4302434234]]).then(result => {
console.log(result);
return 0;
}).catch(error => {
console.log(error);
return 1;
});