0

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

enter image description here

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

enter image description here

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 ?

Dominique Fortin
  • 2,212
  • 15
  • 20
Mithun Sarker Shuvro
  • 3,902
  • 6
  • 32
  • 64

1 Answers1

2

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();
stephen mallette
  • 45,298
  • 5
  • 67
  • 135