我正在使用 Firestore 开发应用程序。我想读取从文档 B 引用的文档 A 的数据并获取我在文档 B 中设置的字段。我搜索了但似乎找不到解决方案。任何帮助将不胜感激。
你可以像这样得到 ref_value
await Firestore.instance
.collection('collection')
.where('ref', isEqualTo: 'what you want to query')
.getDocuments()
.then((doc) {
ref_value = doc.documents[0]['ref'];
});
得到另一个参考
await Firestore.instance
.collection('collection')
.where('ref', isEqualTo: ref_value)
.limit(1)
.getDocuments()
.then((doc) {
ref_value = doc.documents[0]['ref'];
});
此代码可以帮助您进一步尝试。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句