[英]How can i use .where in firebase?
I have this part of code to get a collection firebase我有这部分代码来获取集合 firebase
const db = getFirestore(app)
const getCollection = name => collection(db, name)
const query = await getCollection(db, 'movies').where('name', '==', 'any')
i am getting error in .where
is not a function, what is the wrong?我在
.where
is not a function 中遇到错误,有什么问题?
Unhandled Rejection (TypeError): collection.where is not a function未处理的拒绝(TypeError):collection.where 不是函数
You're using the new modular SDK, where all functions are top-level.您正在使用新的模块化 SDK,其中所有功能都是顶级的。
To create a query, do:要创建查询,请执行以下操作:
const query = query(collection, where('name', '==', value))
Also see the Firebase documentation on building queries .另请参阅有关构建查询的 Firebase 文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.