在firestore和商品实践中插入封装的物体

Die*_*cio 5 angularjs firebase-realtime-database google-cloud-firestore angularfire5

我有一个关于在angularfire 的firestore中插入对象的问题:

我的对象 Person.ts

name: String
age: Number
//--constructor--
//--getters and setters--
Run Code Online (Sandbox Code Playgroud)

如果我这样做,请插入:(但这是一个好习惯吗?)

[person.component.ts]
      this.db.collection("person").add({
              name: this.person.$nome,
              age: this.person.$email
          })
    ...
Run Code Online (Sandbox Code Playgroud)

但如果我尝试:

    [person.component.ts]
         this.db.collection("person").add({
                     Person: this.person
//or this this.person
                  })
Run Code Online (Sandbox Code Playgroud)

我在浏览器控制台中收到此错误:

使用无效数据调用函数 DocumentReference.set()。不支持的字段值:在 new FirestoreError (error.js:149) 处的自定义 Person 对象(在字段 Person 中找到)