I am using Orientjs to create a vertex with some properties and one link property "Relation" and one sequence property "PersonID". Though I dont know how could I achieve the following:-
var trx = this.db.let('Person',function(p){
p.create('vertex','Person')
.set({
"Name": "ABC",
"Relation": "select from RelationType where TypeID = " + ID,
"PersonID": "sequence('personid').next()"
})
}).commit().return('$Person').all()
The "ID" in the above query is from the input. I am not sure how could I handle the nested query for Link property and Sequence property. Any help is appreciated. Thanks
Use db.rawExpression() to accept the queries as is. The following is the solution
var trx = this.db.let('Person',function(p){
p.create('vertex','Person')
.set({
"Name": "ABC",
"Relation": db.rawExpression("select from RelationType where TypeID = " + ID),
"PersonID": db.rawExpression("sequence('personid').next()")
})
}).commit().return('$Person').all()