【发布时间】:2019-09-23 17:39:18
【问题描述】:
我想更改我在 firestore 中的文档集合中命名为 boston 的每个州的名称,如何通过 firestore 中的文档列表进行查询,然后使用 react native 将当前状态名称更改为新名称?
我试过了
export const Save = ({ NewName }) => {
var db = firebase.firestore()
var batch = db.batch();
var sfDocRef = db.collection("cities").where("state", "==", "boston");
var sfRe = db.collection("country").doc("SF");
return () => {
batch.update(sfDocRef, {"state": NewName})
batch.update(sfRe, {"state": NewName})
batch.commit()
}
}
但出现此错误
函数 WriteBatch.update() 要求其第一个参数是 DocumentReference,但它是:自定义查询对象
【问题讨论】:
标签: firebase react-native google-cloud-firestore