Variable assignment from count() operation

9 views
Skip to first unread message

Russell Jurney

unread,
Jan 22, 2018, 1:40:41 PM1/22/18
to gremli...@googlegroups.com
I want to run this: 

// Setup sessions so we can remember variables
:remote connect tinkerpop.server conf/remote.yaml session

userCount = g.V().hasLabel('user').count()
assert(userCount == 4067599)

However, userCount does not contain the value. userCount.next() does not return anything either. g.V().hasLabel('user').count() does not return the count.

How do you assign the result of a Gremlin query to a variable and retain it? I read the docs and I still can't make sense of it.

Thanks,

Stephen Mallette

unread,
Jan 22, 2018, 1:46:58 PM1/22/18
to Gremlin-users
with that assignment, userCount contains a Traversal instance. you need to iterate your traversal:

userCount = g.V().hasLabel('user').count().next()


--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/CANSvDjrEDzpUOF7UC%2B8UC42VX4%2Bnhf%3DA1Z4NhAVab1kDFq7odA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Russell Jurney

unread,
Jan 22, 2018, 9:15:38 PM1/22/18
to gremli...@googlegroups.com
I kept trying that, but it did not work. Now it does. I guess my session was wack? Thanks!


Reply all
Reply to author
Forward
0 new messages