我正在使用新的螺栓编译器(在此处介绍:https://www.firebase.com/blog/2015-11-09-introducing-the-bolt-compiler.html)
我需要在我的类型Event的owner字段中定义一个索引:
type Event { description : String | Null, name : String, color : Number, owner : String, shared : Boolean index() = "owner"; }
当我尝试编译此代码时,我得到以下输出:
bolt: Generating rules.json... bolt:1:1: Unsupported method name in type statement: 'index' (allowed: 'validate', 'read', 'write')
请帮忙:我该如何定义索引?我想我需要在路径声明中定义它们?
bolt编译器的文档在定义索引时并不多:https://github.com/firebase/bolt/blob/master/docs/language.md
刚刚找到答案:
path /users/$uid/events { index() = "owner"; }