I'm using Gremlin (JS library) to communicate with JanusGraph. I have the following groovy code which works well in the groovy console:
g.V().project('id', 'data').by(id).by(valueMap('value').by(unfold()))
But when I copy this code to JS it says that id, valueMap, and unfold are undefined. How can I rewrite the groovy code to valid JS?
EDIT
I know I can use the client and submit the query as shown below, but that's inconvenient given the fact that we already have, I suppose, a fully working JS library.
const c = new driver.Client('ws://localhost:8182/gremlin');
const q = `
g.V()
.project('id', 'data')
.by(id)
.by(
valueMap('value')
.by(unfold())
)
`;
return await c.submit(q);