有没有办法定义数据类型 firebase

is there a way to define datatypes firebase

我想知道是否有办法在 firebase 中定义任何类型的数据模式?我能找到这样的东西。 我目前正在为一个项目调查 firebase,想知道是否可以在 firebase 内部定义某个对象及其属性的外观。

从 mongoose 知道,拥有服务器端对象模型以防止客户端将错误数据写入数据库非常有帮助。

使用 security rules and more specifically the Blaze security language,您可以在 Firebase 数据树上强制执行架构。
来自链接 post:

Developers that use denormalization may find they repeat whole subtrees of information in multiple places in a Firebase. The Blaze language caters for reuse of subtrees by allowing schemas to be defined and reused many times.

Blaze 语言可以让您定义如下示例:

schema:
  definitions:
   message:
     type: object
     properties:
       from:    {type: string}
       to:      {type: string}
       message: {type: string}

$userid:
  properties:
    inbox:
      $messages: {$ref: "#/definitions/message"}
    outbox:
      $messages: {$ref: "#/definitions/message"}