Reputation: 1223
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')
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?
Upvotes: 0
Views: 115
Reputation: 1223
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.
Upvotes: 1