$ Other的FireBase doc在哪里?

时间:2016-10-24 15:29:56

标签: firebase firebase-realtime-database firebase-security

我正在学习FireBase,现在正在Using $ Variables to Capture Path Segments '我读到了通配符的用法。我看到他们使用这个$other变量。 FireBase在RealTime数据库规则中使用的所有变量的列表文档在哪里?

1 个答案:

答案 0 :(得分:2)

没有$ other其他变量。它是一个占位符,可以是任何字符串,如$ someOtherPath,或$ dudesPath或$ coolPath

来自docs

{
  "rules": {
    "widget": {
      // a widget can have a title or color attribute
      "title": { ".validate": true },
      "color": { ".validate": true },

      // but no other child paths are allowed
      // in this case, $other means any key excluding "title" and "color"
      "$other": { ".validate": false }
    }
  }
}

考虑“标题”和“颜色”路径并设置规则。 $ other是标题或颜色以外的任何路径。它可能很容易

“$ anyPathOtherThanTitleOrColor”:{“。validate”:false}