I have a function that I call from sails-orientdb which is supposed to update a linkmap on a class. I have tested the function on orient studio and it works fine. However when I call it from sails-orientdb it doesnt update the linkmap.
The orient function is here
var gdb = orient.getGraph();
var lastKey = gdb.command("sql","select last(feed.keys()) as lastKey from " + user)[0].getRecord().toMap()["lastKey"];
if(isNaN(parseInt(lastKey)))
lastKey = 0;
print('\nUser = ' + user);
print('\nItem = ' + item);
print('\nlastKey = ' + lastKey);
var command = "update " + user + " put feed = \"" + (parseInt(lastKey) + 1).toString() + "\" , " + item
print('\ncommand = ' + command);
var results = gdb.command("sql", command);
print('\nresults = ' + results);
return results
results above prints out a value of 1
And the sails-orientdb call is here
User.query("select Fan_Out_Write(#26:0 , #12:9)", function (err, result) {
if (err) return callback(err, null);
return callback(null, result);
});
Any ideas why this is not being committed from sails-orientdb?
From Studio there is the HTTP layer that calls the db.commit();
After the update command you need to commit if calling from external libraries
gdb.commit();