project("p").by(__.values("a", "b") Only Outputs Single Property, Bug or Expected?
I am curious why this does not behave in the way I expected. Not a problem - solution question.
I created the following Gremlin:
And in above scenario the
A bit surprising that it did not work the way I expected but If it is an expected behavior, then I will remember so from now on. Curious if that is the case why it is designed that way.
I created the following Gremlin:
g.E().
hasLabel("hiddenFrom").
inV().
hasLabel("Person").
project("Trial", "Site", "Subject ID").
by(__.out().out().values("tag")).
by(__.out().values("tag")).
by(__.values("localId", "uuid"))And in above scenario the
Subject ID output only outputs the localId property but not uuid property. When I change by(__.values("localId", "uuid")) to by(__.valueMap("localId", "uuid")) I can get the uuid property value in the output.A bit surprising that it did not work the way I expected but If it is an expected behavior, then I will remember so from now on. Curious if that is the case why it is designed that way.
Solution
i think the more specific way to answer this question is to say that
by() modulators only grab the first item in the traversal provided to it so if you want all of them you need to provide your own reducing operator to convert all the items into a single one. typically this is done with fold(): by(__.values("localId", "uuid").fold())e