and I found that not using return value at Result.prototype.update()
Resultset.prototype.update = function (updateFunction) {
...
// pass in each document object currently in resultset to user supplied updateFunction
for (var idx = 0; idx < len; idx++) {
// if we have cloning option specified or are doing differential delta changes, clone object first
if (this.collection.cloneObjects || !this.collection.disableDeltaChangesApi) {
obj = clone(rcd[this.filteredrows[idx]], this.collection.cloneMethod);
updateFunction(obj); // here
this.collection.update(obj);
}
else {
// no need to clone, so just perform update on collection data object instance
updateFunction(rcd[this.filteredrows[idx]]); // and here
this.collection.update(rcd[this.filteredrows[idx]]);
}
}
return this;
};
so, if you want update a lot of property, you should code below.
I think it's so exhausting.
how about using return value like below?
Resultset.prototype.update = function (updateFunction) {
...
// pass in each document object currently in resultset to user supplied updateFunction
for (var idx = 0; idx < len; idx++) {
// if we have cloning option specified or are doing differential delta changes, clone object first
if (this.collection.cloneObjects || !this.collection.disableDeltaChangesApi) {
obj = clone(rcd[this.filteredrows[idx]], this.collection.cloneMethod);
var updatedObj = updateFunction(obj);
this.collection.update(updatedObj);
}
else {
// no need to clone, so just perform update on collection data object instance
var updatedObj = updateFunction(rcd[this.filteredrows[idx]]);
this.collection.update(updatedObj);
}
}
return this;
};
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I try to update document
but it wan't working.
and I found that not using return value at
Result.prototype.update()
so, if you want update a lot of property, you should code below.
I think it's so exhausting. how about using return value like below?