Question

Suppose I want to collect all bookName as follows:

x = g.V.has("books").bookName

it shows outpuat as :

=>Groovy
=>Java
=>Oracle

..

I want to create a list from the above in the following manner :

x = ["Groovy","Java","Oracle"]

How to create the above list so that I can iterate the list further ?

Was it helpful?

Solution

You can use the toList() method, so your query becomes:

x = g.V.has("books").bookName.toList()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top