【发布时间】:2019-02-04 05:06:16
【问题描述】:
我想我在 Angularfire2 查询方面遗漏了一些东西。我收到以下错误:
ERROR TypeError: db.list(...).orderByChild is not a function
这是我产生的错误:
this.itemsRef = db.list('projects/').orderByChild('buyerEmail').equalTo(user.email);
this.items = this.itemsRef.snapshotChanges().pipe(
map(changes =>
changes.map(c => ({ key: c.payload.key, ...c.payload.val() }))
)
);
这个,但是返回我试图深入研究的列表:
this.itemsRef = db.list('projects/');
this.items = this.itemsRef.snapshotChanges().pipe(
map(changes =>
changes.map(c => ({ key: c.payload.key, ...c.payload.val() }))
)
);
JSON:
projects
-LXpud3uxRaTHKIRa4Da
ProjectName: "1234 sesame st."
buyerEmail: "matt@theInternet.com"
-LXpud3uxRaTHygr56aT
ProjectName: "789 sesame st."
buyerEmail: "joe@theInternet.com"
任何帮助将不胜感激。
编辑: 事实证明这是解决我的问题的错误方法。我最终保存了我想要的“密钥”并使用它来查找对象。在这种情况下无需查询列表。
【问题讨论】:
标签: angular firebase ionic-framework firebase-realtime-database angularfire2