首页 > 解决方案 > 索引未在 firebase 中定义

问题描述

这是我收到的错误:

 "error" : "Index not defined, add \".indexOn\": \"release/date\", for path \"/north_america\", to the rules"

这是我的firebase数据的结构:

在此处输入图像描述

而且我添加的规则似乎不起作用,有什么帮助吗?

在此处输入图像描述

标签: firebasefirebase-realtime-database

解决方案


尝试使用下一级的索引再次更新您的数据库规则。

"likes": {
  "north_america": {
    "$someid": {
      "release": {
        ".indexOn": ["date"]
      }
    }
 }

此外,您应该能够使用通配符,north_america以便它可以在全球范围内使用。


推荐阅读