0

I have ran the gremlin query and get the result but not able to get each vertex properties.

Here is the query I have ran:

g.V('a6b575a5-e2d3-334d-aa0b-5aa372d71fc0').outE('member').inV().unfold().toList()

Here is the result properties are undefined how to get?

2019-05-27T01:21:51.292Z    9f82a2ab-4271-406c-9601-0479899ccb61    [ Vertex {
id: '2cb575ab-d398-8a18-4c8c-4d5f6cca6076',
label: 'tribe',
properties: undefined },
Vertex {
id: '5eb575ad-59e5-0878-3d05-297c390b0479',
label: 'tribe',
properties: undefined } ]
Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38

2 Answers2

2

You should add the valueMap step at the end of the query.

g.V('a6b575a5-e2d3-334d-aa0b-5aa372d71fc0').outE('member').inV().valueMap(true).toList()

noam621
  • 2,766
  • 1
  • 16
  • 26
  • 1
    If you don't need values from the edge you can simplify the query to just : `g.V('a6b575a5-e2d3-334d-aa0b-5aa372d71fc0').out('member').valueMap(true).toList()` – Kelvin Lawrence May 29 '19 at 20:15
1

you can use below working code (Async/await node code)

  const data = await g.V().toList();
  for (const v of data) {
    const _properties = await g.V(v.id).properties().toList();
    console.log(`${v.id} - ${v.label} - ${_properties}`);
  }