![](/img/trans.png)
[英]I can not get data from firebase from a specific user (using the uid check method)
[英]Query specific uid in Firebase using Angular2+
我真的很困惑如何通过 uid 查询 firebase 中的单个记录。 我有一个用户id,想查询下表。 我正在使用以下代码。 但是,它返回的是两条记录,而不仅仅是 'this.selectedId' 一条。 有没有 1) 一种只返回被查询记录的方法 2) 保留键而不是索引数组 0、1、2、3 等...
使用的代码
const itemsRef = this.afs.collection<any>(`/profiles/`);
itemsRef.valueChanges(this.selectedId).subscribe(
x => {
console.log("Value change", x);
}
);
图像
valueChanges
方法不接受任何参数。 如果要监控单个文档
const itemRef = this.afs.doc<any>(`/profiles/`+this.selectedId);
itemRef.valueChanges()...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.