After inserting a vertex in amazon neptune , I get the an unique id . If I want to print out the properties of a vertex , I can do it easily in gremlin console
But in my node js app , if I try to do the same I can't get the properties of the vertex
Here is what I have done in javascript
const fetchPropertyByVertexId = async (vertexId) => {
console.log("requsting properties of vertex "+vertexId);
return await g.V(vertexId).properties();
}
and then , I call
fetchPropertyByVertexId(vertexId).then( property =>{
console.log(property);
});
And the output is
I am using this library to connect with amazon neptune . How can I get property of a vertex , in key value pair , like I get it in gremlin console ?
I think that you need to iterate your traversal. This:
return await g.V(vertexId).properties();
returns a Traversal
object which does not return results - it just represents the object to iterate to get results. So, you need to include a terminal step like toList()
:
return await g.V(vertexId).properties().toList();