简体   繁体   English

firebase v8升级到v9

[英]Upgrading firebase v8 to v9

Firebase - > Firestore Firebase - > Firestore

I have this code which I want to convert it into v9 but can't seem to figure out the correct syntax.我有这段代码,我想将其转换为 v9,但似乎无法找出正确的语法。

 db.collection('chats').doc(router.query.id).collection('messages').orderBy('timestamp', 'asc')

It's something like that:是这样的:

const ref = collection(db, `chats/${router.query.id}/messages`)
const q = query(ref, order('timestamp', 'asc'))
const snapshot = await getDocs(q)
if(snapshot.exits()) console.log(snapshot.docs)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM