How to extract the result of a query from JSON inside a custom javascript function in OrientDB

强颜欢笑 提交于 2019-12-06 06:48:12
Lvca

OrientDB put ODocument objects in the result set array. So try this:

return res[0].getRecord().field( "lower_num" );
var jsonhelp= [ { "@type": "d", "@rid": "#-2:1", "@version": 0, "lower_num": 2 } ];

var extractedNumber = jsonhelp[0].lower_num;

Now you can compare it with whatever you want; I hope it helps

like this you can extract any of the properties in JSON.

But in javascript there are two types of comparison

1) == simply compares values ,don't consider type
ex. '5' == 5 true , both are 5
     5 == 5 true.
2)=== considers type too
ex. '5' === 5 is false, different type i.e String === integer
     5 === 5 is true ,same type 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!