【发布时间】:2019-11-21 10:31:14
【问题描述】:
如何将对象添加到 firebase 中的对象数组中? 我可以使用这段代码创建一个对象数组,但我不能向其中添加对象。
return this.db.doc(`Users/${userCredential.user.uid}`).set({
email: this.newUser.email,
firstname: this.newUser.firstName,
lastname: this.newUser.lastName,
balance: this.newUser.balance,
movimentos: [
{ valor: 69, tipo_movimento: 'Débito' },
{ valor: 19, tipo_movimento: 'Crédito' },
{ valor: 29, tipo_movimento: 'Débito' },
]
})
}
我尝试在数组中添加一个对象:
return this.db.collection(`Users/${userKey}`).add({
movimentos: [
{ valor: 6669, tipo_movimento: 'Débito' },
]
});
}
【问题讨论】:
标签: javascript angular firebase google-cloud-firestore