我有以下節點:
attendanceOptions: {
uid1: '[email protected]',
uid2: '[email protected]'
}
我試圖只回傳值等于的鍵和值。這是我的兩次嘗試。
const getMinistry = await admin.database().ref(`organization/${req.orgId}/attendanceOptions`)
getMinistry
.equalTo(req.memberUid)
.once('value', snapshot => {
functions.logger.log(snapshot.val())
});
這回傳 null 我也試過:
const getMinistry = await admin.database().ref(`organization/${req.orgId}`)
getMinistry
.orderByChild('attendanceOptions')
.equalTo(req.memberUid)
.once('value', snapshot => {
const data = snapshot.val();
functions.logger.log( `this is data: ${data}` )
return data;
});
日志是this is data: null
在我的規則中,我有:
"attendanceOptions": {
".indexOn": [".value"]
},
我在這里做錯了什么?
uj5u.com熱心網友回復:
正確的語法是:
getMinistry
.child('attendanceOptions')
.orderByValue()
.equalTo(req.memberUid)
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/437916.html
