Open fredspivock opened 4 years ago
Hey @fredspivock ,
Do you have some example code?
Here is an example, I have to check if they are empty before adding them to a batchwrite, if the array is empty it will error. I want it to ignore empty arrays would remove my need to do this check.
try {
let questionStoreInstance = questionStore.batchWrite();
if (questionsToDelete.length !== 0) {
questionStoreInstance = questionStoreInstance.delete(questionsToDelete);
}
if ((questionsToCreate.length + questionsToUpdate.length) !== 0) {
questionStoreInstance = questionStoreInstance.put([...questionsToCreate, ...questionsToUpdate])
}
await questionStoreInstance.exec();
} catch (e) {
logger.error(`Cannot update questions: ${e}`);
return buildReturnBody(e);
}
I need to check if my array is empty before doing a batch write
Would be nice if it just ignored empty arrays.
(also handling batch over 25 would be amazing)
Thanks!