I tried to execute this code using functions at OrientDB Studio.
commandResult = db.executeCommand('insert into user (facebookId,instagramId) values ("' + facebookId +'","'+ instagramId +'");
if( commandResult.length == 0){
response.send(200, "ok", "application/json","{\"success\":\"false\"}");
} else {
response.send(200, "ok", "application/json","{\"success\":\"true\", \"@rid\" : \"" + commandResult + "\"}");
}
and then it returns like this
{"success":"true", "@rid" : "user#11:15{facebookId:df,instagramId:sdf} v1"}
My problem now is i want only to return only the rid value. But the problem is in my second key "user#11:15{facebookId:df,instagramId:sdf} v1"
. I don't know how am I going to parse it since the @rid
is in the outside of the curly brace.
Hope from your positive response.
Thanks.
You're concatenating strings. Use the .toJSON() instead:
response.send(200, "ok", "application/json",
"{ \"success\":\"true\", \"@rid\" : \"" +
commandResult.toJSON() + "\"}");