batch()
Usage
batch(expression, batchSize)
Description
Enables batching for the given expression, i.e. if the expression contains a long-running function (for example the deletion of all nodes of a given type, see examples below), that function will be instructed to commit its results in batches of batchSize
.
Useful in situations where large numbers of nodes are created, modified or deleted in a StructrScript expression.
Examples
${batch(delete(find('Item')), 1000)}
${batch(each(find('Item'), set(data, "visibleToPublicUsers", true)), 1000)}
Batching in server-side JavaScript
For examples how to use batching in server-side JavaScript scripts, see this article.