Javascript 值为的Firebase筛选器
以下电话:Javascript 值为的Firebase筛选器,javascript,firebase,firebase-realtime-database,Javascript,Firebase,Firebase Realtime Database,以下电话: fDB.ref(`organization/${uid}/attendance/${date}`) .once('value') .then(d => console.log(d.val())) 返回如下所示的对象: { '-Lz8YxH_n7a5C6wv5vrX': 'absent', '-Lz8YxHbn5iOCxaGUBZt': 'absent', '-Lz8YxHfQPKH5BaIJBK_': 'absent', '-Lz8YxHiwp8QZW3TqAFn
fDB.ref(`organization/${uid}/attendance/${date}`)
.once('value')
.then(d => console.log(d.val()))
返回如下所示的对象:
{ '-Lz8YxH_n7a5C6wv5vrX': 'absent',
'-Lz8YxHbn5iOCxaGUBZt': 'absent',
'-Lz8YxHfQPKH5BaIJBK_': 'absent',
'-Lz8YxHiwp8QZW3TqAFn': 'present',
'-Lz8YxHjtMUkroeyT5bv': 'absent',
'-Lz8YxHmHqDblmBY4jyx': 'absent',
'-Lz8YxHo-e4AiOwwex0s': 'absent',
'-Lz8YxHqQXWoaGOFRLrO': 'present',
}
如何仅查询缺少的值?
我试过:
上面的返回值为null
我也试过了
fDB.ref(`organization/${uid}/attendance/${date}`)
.orderByKey()
.equalTo('absent')
.once('value')
.then(d => console.log(d.val()))
同样的东西是空的。如何实现它?它将使用
equalTo
在日期节点上使用orderByValue
进行筛选,允许您运行筛选值:
fDB.ref(`organization/${uid}/attendance/${date}`)
.orderByValue()
.equalTo('absent')
.once('value')
.then(d => console.log(d.val()));
fDB.ref(`organization/${uid}/attendance/${date}`)
.orderByValue()
.equalTo('absent')
.once('value')
.then(d => console.log(d.val()));