现在我使用janusgraph-0.2.0-hadoop2服务器和gremlin@2.6.0库查询
const Gremlin = require("gremlin");
const client = Gremlin.createClient(8182, "192.168.0.103");
function test(p){
client.execute(q, {}, (err, results) => {
if (err) {
console.error(err);
client.closeConnection();
}
else {
console.log(results);
client.closeConnection();
}
});
}查询g.V().count()的结果是[ 12 ]
查询g.V().has('name', 'saturn').valueMap()的结果是[ { name: [ 'saturn' ], age: [ 10000 ] } ]
我不介意
但是在更新我的janusgraph-0.5.0-hadoop2服务器并使用相同的库gremlin@2.6.0之后
在不同的中获取数据
查询g.V().count()的结果是[ { '@type': 'g:Int64', '@value': 12 } ]
对于查询g.V().has('name', 'saturn').valueMap()的结果是
将gremlin@3.4.6的[ { '@type': 'g:Map', '@value': [ 'name', [Object], 'age', [Object] ] } ]更新库
const gremlin = require('gremlin');
const client = new gremlin.driver.Client('ws://192.168.0.106:8182/gremlin', { traversalSource: 'g' });
async function test(q){
const res = await client.submit(q, {});
console.log('res',res)
client.close();
}
test()查询g.V().count()的结果是[ 12 ]
查询g.V().has('name', 'saturn').valueMap()的结果是[ Map { 'name' => [ 'saturn' ], 'age' => [ 10000 ] } ]
在Hashmap中获取数据我想知道
1. Is it necessary to update gremlin library 3.4.6 getting correct result.
2. After updating to 3.4.6 get data in hashmap format, Means i want to know i am getting correct data or not.
3. I want data in object format but got in hashmap. I know i can convert to object but incase data is in nested hashmap, I dont want to repeat and convert it.请给我一些建议
发布于 2020-04-03 23:59:15
我想说,这是一个非常好的想法,在当前版本的Janus图。注意,您应该使用Janus图形附带的Gremlin库,而不是独立地更新这些库。最近的Javascript/Node客户机确实像您看到的那样返回Map类型。
https://stackoverflow.com/questions/61015999
复制相似问题