database - 在保存之前验证 Firebase JSON 的结构

标签 database firebase firebase-security

我正在尝试使用 Firebase。我有很强的 MS SQL Server 数据库背景。您如何验证保存在 Firebase 中的 JSON 数据以匹配特定结构?有没有办法将“接口(interface)”应用于 JSON 以确保我们具有正确的结构?不然你怎么对保存的数据有信心?

最佳答案

架构!听起来你会喜欢 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帮助您入门。

关于database - 在保存之前验证 Firebase JSON 的结构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33657596/

相关文章:

swift - Firestore 权限不足

firebase存储-防止垃圾邮件

php - 在搜索引擎优化 (SEO) 的 URL 中包含博客文章标题?

database - 一对多关系:没有在数据库上创建任何条目

sql - oracle sql developer tool - 提交后数据不可用

javascript - FIREBASE 警告 : Using an unspecified index. 无法从 Firebase 获取数据

sql - SQLite:使用ID和哈希值合并两个表,其中得到的ID来自所选表

node.js - 删除磁盘后使用 npm 安装 firebase 时出错

FirebaseAuth 禁用用户检查并注销?

javascript - Firebase:异步/等待事务