Closed
Description
Getting the provided sample code for nodejs:
- I'm trying to modify only one property ('done') of the entity Task in sample code tasks.markdone.js
- What code you've already tried: tasks.add.js and tasks.markdone.js
- Any error messages you're getting: no
I'm expecting the code in tasks.markdone.js should modify only one property -- done. But it actually modifies two properties: done (as expected) and description. Initially, description property in not indexed as it is created in tasks.add.js. But tasks.markdone.js makes it indexed, that is not expected and undesired.
For this particular case it's easy to fix:
transaction.save({
key: taskKey,
data: task,
excludeFromIndexes: [
"description"
]
});
But in real life fields that are excluded from indexes might be dynamic, so
The question is: What is the best way to get an entity preserving all it's indexed/unindexed fields, modify just one field and save it in the way not to change not touched indexes?