【发布时间】:2019-11-22 10:42:47
【问题描述】:
批量写入中的操作是否保证按照调用顺序执行?根据the docs 不清楚。是否强制只有 (#0) -> (#1) -> (#2) 而不是其他方式?
const batch = db.batch();
const nycRef = db.collection('cities').doc('NYC');
batch.set(nycRef, {name: 'New York City'}); // (#0)
const sfRef = db.collection('cities').doc('SF');
batch.update(sfRef, {population: 1000000}); // (#1)
const laRef = db.collection('cities').doc('LA');
batch.delete(laRef); // (#2)
return batch.commit().then(function () {
// ...
});
【问题讨论】:
标签: firebase google-cloud-firestore