I need to update a specific record in my User class. I don't have any field with a unique index so I need to use the @rid field.
How can I use orientjs to update a specific record with dynamic properties ?
I would like to use the query builder if possible because my updated record is in the request body.
Here is what I've tried :
var id = '#' + req.param('id');
db.update('User').set(req.body).where({@rid: id}).scalar()
.then(function (total) {
console.log('updated', total, 'users');
});
It gives me a syntax error because I cannot use the @rid in the where clause :
db.update('User').set(req.body).where({@rid: id}).scalar()
^
SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/alexandre/Documents/bitbucket/rest-api/server/routes/index.js:4:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/alexandre/Documents/bitbucket/rest-api/server/server.js:25:14)
at Module._compile (module.js:460:26)