聚合物 Firebase。对象中的数组

Polymer Firebase. Arrays in Objects

我正在使用 polymer 和 firebase,我想知道如何在一个对象内创建一个对象数组。

我想要嵌套数据,例如对象中的组单个对象,我们在其中包含成员和名称

      this.$.query.ref.push({
        name: this.$.crewName.value,
        description: this.$.crewDescription.value,
        createddate: new Date().toString(),
        creator: this.$.createcrewlogin.user.uid,
        slug: sluggedname
      });

使用像这样的简单推送方法。我如何实现它

当您从 JavaScript 写入 Firebase 数据库时,您会传入一个 standard JSON object。这意味着您可以将对象嵌套在传递给 push():

的对象中
  this.$.query.ref.push({
    name: this.$.crewName.value,
    description: this.$.crewDescription.value,
    createddate: new Date().toString(),
    creator: this.$.createcrewlogin.user.uid,
    slug: sluggedname,
    subobject: {
      techpioneers: true,
      womentechmakers: true
    }
  });