如何在AngularFire中实现这一目标?
this.db.collection('users')
.onSnapshot({ includeDocumentMetadataChanges: true }, function (doc) {
var result = [];
doc.docs.forEach(element => {
if (!element.metadata.hasPendingWrites) {
result.push(element.data())
}
});
return result;
});
答案 0 :(得分:-1)
此代码在AngularFire中应具有相同的作用。
this.angularFirestore.collection('users')
.snapshotChanges()
.subscribe(documents => {
const result = [];
documents.forEach(document => {
if (!document.metadata.hasPendingWrites) {
result.push(document.data());
}
});
return results;
});