-
Notifications
You must be signed in to change notification settings - Fork 0
JSMumps.setObject()
John Willis edited this page Mar 21, 2017
·
2 revisions
Stores an ECMAScript object in a MUMPS global.
jsm.setObject(global, subscripts, object, callback);global
The name of the MUMPS global into which the object will be stored.
subscripts
An ECMAScript array indicating the subscript level within global into which the object will be stored
object
The ECMAScript object to be stored into global
callback
The callback to be called when the object has been stored.
This example will store object bobAccount into ^ACCOUNT("bob").
const jsmumps = require('jsmumps');
var jsm = new jsmumps.JSMumps();
var bobAccount = {
email: '[email protected]',
birthday: '10/22/1958'
name: {
first: 'Bob',
last: 'Dobbs'
}
};
jsm.setObject('ACCOUNT', ['bob'], bobAccount, (err, data) => {
if(!err) {
console.log('Account stored successfully!');
}
});After running the above example, the database will appear as follows:
^ACCOUNT("bob","email")="[email protected]"
^ACCOUNT("bob","birthday")="10/22/1958"
^ACCOUNT("bob","name","first")="Bob"
^ACCOUNT("bob","name","last")="Dobbs"