Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
update()<br />
Example 1: Unlock one node<br />
mydata.unlock(<br />
{global: "Customer", subscripts: [1]},<br />
function(error, result) { // callback code }<br />
);<br />
Result:<br />
Operation successful if no error reported.<br />
Example 2: Unlock all locked nodes<br />
mydata.unlock(<br />
function(error, result) { // callback code }<br />
);<br />
Result:<br />
Operation successful if no error reported.<br />
4.19 update()<br />
The update() method writes the contents of a JSON object to the <strong>Caché</strong> database.<br />
• The update("array") method performs the opposite task to that performed by the retrieve method. In other words<br />
the update method takes an array of global nodes, each expressed as a single JSON object and writes them back to the<br />
<strong>Caché</strong> database.<br />
• The update("object") method performs the opposite task to that performed by the retrieve method. In other words<br />
it writes the contents of a structured JSON object back to the <strong>Caché</strong> database.<br />
Synchronous<br />
Asynchronous<br />
Parameters<br />
var result = mydata.update(node, type);<br />
mydata.update(node, type, callback_function);<br />
• node — the global node to be accessed.<br />
• type — a literal string specifying the type of data to be accessed. Options are:<br />
– "array"<br />
– "object"<br />
• callback_function — a function of the form function(error, result){} used to return results<br />
asynchronously (see “Synchronous vs. Asynchronous cache.node Methods”).<br />
Example 1 (type = “array”): Create or update a record for a customer<br />
mydata.update(<br />
[<br />
{ global: "Customer",<br />
subscripts: [1],<br />
data: "Chris Munt"<br />
}<br />
<strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong> 33