Вы должны сначала выполнить запрос, а затем обновление - это multi-location update будет лучше:
import "rxjs/add/operator/first";
import "rxjs/add/operator/toPromise";
angularFire.database
// Query all of the elements that have type equal to A:
.list("Class", {
query: {
orderByChild: "type",
equalTo: "A"
}
})
// Use the first operator to complete the observable, as
// only the first emitted list is required:
.first()
// The update call will return a promise that resolves to
// void, so the observable might as well be converted to a
// promise:
.toPromise()
// Build a multi-location update so that all of the matching
// elements can be updated simultaneously:
.then(list => {
if (list.length > 0) {
let multi = {};
list.forEach(element => {
multi[`${element.$key}/type] = "C";
});
return angularFire.database
.object("Class")
.update(multi);
} else {
return Promise.resolve();
}
});
спасибо .. это решить мои проблемы 100% – devMan