To execute the sequence we created in the previous section, use
the
Store.executeUpdates()
method:
... // Store handle configuration and open skipped for brevity ... store.on("open",function (err) { if (err) throw err; store.executeUpdates(operations, function(err, result) { if (err) throw err; else { console.log("Inserted rows."); store.close(); } }); }).on('close', function() { console.log('Store closed.'); }).on('error', function(error) { console.log(error); }); store.open();
Note that if any of the above errors are thrown, then the entire sequence is aborted, and your data will be in the state it would have been in if you had never executed the sequence at all.
Store.executeUpdates()
can optionally take
a WriteOptions
object. This
object allows you to specify:
The durability guarantee that you want to use for this
sequence. If you want to use the default durability
guarantee,
do not set this property, or set it to null
.
A timeout value that identifies the upper bound on the
time interval allowed for processing the entire
sequence. If you provide 0
,
the default request timeout value is used.
A ReturnChoice
value that indicates
whether you want to return the value resulting from the
operation, the row's version, both of these things, or
nothing.
For an example of using WriteOptions
,
see Durability Guarantees.