valueMap returning empty object with Neptune

104 Views Asked by At

First let me say two things: I'm starting with graphDB and I tried this post: Gremlin's valueMap() returns an empty object with JS and Neptune and did not work.

I'm following the same steps as I'm using in the gremlin console. In the console is working 100%.
In gremlin console:

gremlin> g.V().hasLabel('user').has('userUuid', '12345').out('knows').order().by(out('knows').count(), desc).range(0, 20).hasLabel('user').valueMap('userUuid', 'username', 'email')

This query is returning: enter image description here

Now, the following NodeJs code is not working with the valueMap function.

  const value = await g.V().hasLabel(constants.USER)
            .has(constants.USER_UUID, '12345')
            .out('knows')
            .order()
            .by(__.out('knows').count(), gremlin.process.order.desc)
            .range(pageIndex, pageSize)
            .valueMap(constants.USER_UUID, constants.USERNAME, constants.EMAIL)
            .toList();

The above code is returning:

Response: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]

Note: if I remove the .valueMap(constants.USER_UUID, constants.USERNAME, constants.EMAIL), the function will return the values as list, instead of mapped into objects for each position inside the list.

What am I doing wrong?

1

There are 1 best solutions below

0
On

I've found this post on AWS: enter image description here

And there is a link to this post here on SOF: Issue with .project().by() in Gremlin JS 3.4.0

This works for me.