in app/src/app/pages/explore/explore.component.ts [138:160]
editDocument(_id, json) {
const partial = this.params.project && Object.keys(this.jsonParser.parse(this.params.project)).length > 0;
const newId = json && json._id && json._id.$value;
const oldId = _id && _id.$value;
if (newId !== oldId) {
this.notifService.notifyError('ObjectId changed. This is not supported, updated canceled.');
return ;
}
this.mongoDb.update(this.server, this.database, this.collection, oldId, json, partial)
.subscribe((res: any) => {
if (res.ok) {
this.items.forEach((item, index) => {
const _id = item && item._id && item._id.$value;
if (_id === oldId) {
this.items[index] = res.update;
}
});
} else {
this.notifService.notifyError(res.message);
}
});
}