我有一个数据库如下:
Root Categories/restaurantid/{text:Item1 AL:Item 2 TEXT:Item 3 ...}
所以我想在一个特定的孩子中推送一个数据(变量myKey),该项目等于第1项。我正在做如下(this.restaurant是restaurantid):
var ref2 = firebase.database().ref().child('/categories/' + this.restaurant);
var query = ref2.orderByChild('text').equalTo(this.categoria1);
query.once('child_added', function(snapshot) {
snapshot.ref().child('dishes').push({
mykey: 'true',
但是我收到一个错误:无法调用类型缺少调用签名的表达式。 “参考”类型没有兼容的呼叫签名。
我在哪里做错了?
答案 0 :(得分:0)
在DataSnapshot
,ref
是属性 - 不是方法 - 因此您的push
调用应该是这样的:
snapshot.ref.child('dishes').push({ mykey: 'true', ...