1

I am using AWS Neptune.

I want to perform a simple gremlin query that returns vertices sorted in decreasing order by a property named "timestamp".

I can do this using the gremlin console:

gremlin> g.V().has('timestamp').order().by('timestamp', desc).fold()

But when I use this same statement from my nodejs application, I get the error "ReferenceError: desc is not defined". I am not surprised by the error, since I have not defined "desc".

My question: how do I pass the sort order in the gremlin query?

Am I missing an import?

I tried passing in the string 'desc' -- that didn't work.

Joel Stevick
  • 1,638
  • 2
  • 16
  • 22

1 Answers1

2

I think you're just missing an import - in 3.3.3:

const gremlin = require('gremlin');
const order = gremlin.process.order;

You can read more about it here. Note that 3.3.4 which is not yet released officially will have support for desc and asc as opposed to decr and incr.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135