Firestore: Add Custom Object to db

前端 未结 8 2014
庸人自扰
庸人自扰 2020-12-15 05:31

Good Morning,

I tried adding a new created object from this class:

export class Sponsor implements ISponsor {

  title: string;    
  description?: s         


        
相关标签:
8条回答
  • 2020-12-15 06:03

    Firestore does not support that. But you can use https://github.com/typestack/class-transformer It works perfectly fine for us.

    0 讨论(0)
  • 2020-12-15 06:04

    You can also use Object.assign({}, sponsor)

    so in yor case it would be

    this.collection.doc(sponsor.id).set(Object.assign({}, sponsor));
    
    0 讨论(0)
提交回复
热议问题