【发布时间】:2018-10-31 20:36:41
【问题描述】:
我正在尝试将数据保存在 Firestore 数据库中
db.collection('clients').doc(clientInformation['id']).set(clientInformation)
.then( result => {
res.status(200).send({ client: result });
});
如果提供的 id 已经存在于 db 上,我想要得到一个错误,我知道 firestore 会覆盖它或为您提供合并此数据的选项,但它可能会收到使用不同的重复键的错误方法而不是“设置”并抓住它?
谢谢!
【问题讨论】:
标签: javascript google-cloud-firestore