我在遵循使用 HERE 中的 count() 聚合的示例时遇到错误
我的代码是:
const collectionRef = db.collection('cities');
const snapshot = await collectionRef.count().get();
const amount = snapshot.data().count;
res.json({ amount });
错误说:
Functions: TypeError: collectionRef.count is not a function
有人可以帮忙吗?
最佳答案
在 firebase-admin@11.2.0
中添加了 count()
查询.如果您使用的是旧版本,请尝试更新到最新版本。
npm i firebase-admin@latest
关于node.js - Firebase 函数 : TypeError: collectionRef. 计数不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74508056/