Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
Using Node.js with Caché - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Reference for cache.node Methods<br />
}<br />
global: "Customer",<br />
subscripts: [1],<br />
data: "Chris Munt",<br />
defined: 1<br />
If there is no further node defined in the sequence then the defined property will be set to zero.<br />
4.16 retrieve()<br />
• The retrieve(node, "list") method will return a list of subscript values that are defined directly beneath a<br />
given level in the global.<br />
• The retrieve(node, "array") method will return a list of subscript values together <strong>with</strong> their associated data<br />
values that are defined beneath a given level in the global. The method is recursive and will retrieve all global nodes<br />
defined beneath a chosen level.<br />
The result will be expressed as an array of global nodes, <strong>with</strong> each global node expressed as a single JSON object.<br />
• The retrieve(node, "object") method will retrieve a structured data object defined beneath a given level in<br />
a global. This method provides a structured alternative to an array of global nodes.<br />
The result will be expressed as a single JSON object.<br />
Synchronous<br />
Asynchronous<br />
Parameters<br />
var result = mydata.retrieve(node, type);<br />
mydata.retrieve(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 />
– "list"<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 = “list”): Retrieve a list of customer numbers<br />
mydata.retrieve(<br />
{global: "Customer"},<br />
"list",<br />
function(error, result) { // callback code }<br />
);<br />
Result:<br />
Three Customer records:<br />
[1, 2, 3]<br />
30 <strong>Using</strong> <strong>Node</strong>.<strong>js</strong> <strong>with</strong> <strong>Caché</strong>