Inserting encapsuled object in firestore and goods practices

I have a question about to insert object in firestore in angularfire:

My object Person.ts

name: String
age: Number
//--getters and setters--

if I do this, insert ok: (BUT is this good practice?)

              name: this.person.$nome,
              age: this.person.$email

but if I try:

                     Person: this.entrevistador
//or this this.person

I get this error in browser console:

Function DocumentReference.set() called with invalid data. Unsupported field value: a custom Person object (found in field Person)
at new FirestoreError (error.js:149)

Source: AngularJS

Related Post