我的資料庫結構是這樣的:
{
"Products" : {
"0100251633" : {
"codes" : {
"Call" : "000156",
"EAN13" : "7898613211028"
},
"productid" : "0100251633",
"nmproduct" : "BRW 12 COLOR HYDROGRAPHIC PEN",
"quantity" : 0,
"stativo" : "S",
"url" : "SemUrl"
}
}
}
我需要通過“呼叫”代碼對我的資料庫進行排序(索引)。
有效的規則(按描述排序)是這個:
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"Products":{
".indexOn": ["nmproduct","codes","Call"]
}
}
}
但我需要通過呼叫代碼進行排序。我正在嘗試這種方式,因為這就是我的理解:
{
"rules": {
".read": "auth.uid != null",
".write": "auth.uid != null",
"Products":{
"Codes":{
".indexOn": ["Call"]
}
}
}
}
它不起作用,我得到以下回報:
raise HTTPError(e, request_object.text)
requests.exceptions.HTTPError: [Errno 400 Client Error: Bad Request for url: https://inventarioshop-8318f-default-rtdb.firebaseio.com/Produtos.json? auth=65465465465465465465465465&orderBy="Chamada"] {
"error" : "Index not defined, add \".indexOn\": \"Call\", for path \"/Products\", to the rules"
}
我非常感謝您幫助理解并能夠向其他人解釋。
uj5u.com熱心網友回復:
要索引節點下的嵌套屬性,您需要在索引定義中指定該屬性的路徑。
因此,對于您的呼叫代碼,它將是:
"Products":{
".indexOn": ["nmproduct","codes/Call"]
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/439752.html
標籤:火力基地 firebase-实时数据库 firebase-安全
