保存之前验证Firebase JSON的结构

时间:2015-11-11 18:42:15

标签: database firebase firebase-security

我用Firebase弄湿了脚。我有一个非常强大的MS SQL Server数据库背景。如何验证Firebase中保存的JSON数据是否与特定结构相匹配?有没有办法应用'界面'到JSON以确保我们有正确的结构?否则,您如何对保存的数据有信心?

1 个答案:

答案 0 :(得分:3)

架构!听起来像你爱the Bolt compiler

Bolt编译器是您在Firebase中表达架构的方式。

使用Bolt,您可以将类型表示为模式,然后将其应用于存储数据的路径。

// Create the schema for a Post type
type Post {
  title: String;
  author: String;
  description: String;
  timestamp: Number;
  isPublished: Boolean;
}

// All data stored at "/posts" will conform to the Post type above
path /posts is Post;

还有quick-startguide可帮助您入门。