【发布时间】:2018-06-04 05:09:52
【问题描述】:
我尝试在 Cloud 功能中使用 Firestore,但遇到了错误
db.collection(...).doc(...).collection(...).doc(...).add 不是 Promise 的函数
我阅读了这些主题first、second 和其他。但是id没有帮助我。 package.json 看起来
"firebase": "^4.3.1",
"firebase-admin": "^5.5.1",
"firebase-functions": "^0.7.5",
云功能之一
const admin = require('firebase-admin');
var db = admin.firestore();
此代码来自函数
const currentUserMatchProm = db.collection('userMatches').doc(currentUserID).collection('test').doc(matchID).add({
'matchID': matchID,
'matchedUserID': eventUserID,
'timestamp': timestamp,
'isActive': false
});
const eventUserMatchProm = db.collection('userMatches').doc(eventUserID).collection('test').doc(matchID).add({
'matchID': matchID,
'matchedUserID': currentUserID,
'timestamp': timestamp,
'isActive': false
});
我该如何解决?
【问题讨论】:
标签: node.js firebase google-cloud-firestore firebase-admin