cancel
Showing results for 
Search instead for 
Did you mean: 

Neo4jClient

BhavinPanchal
Node Link

How to pass a list of maps in UNWIND query using neo4jClient? 
Regards,

Bhavin Panchal

2 REPLIES 2

gerrit_meier
Neo4j
Neo4j

You could either use Java types:

 

List<Integer> valueList = List.of(1, 2, 3, 4);
Map<String, Object> values = new HashMap<>();
values.put("list", valueList);

client.query("UNWIND $list as value return value")
		.bindAll(values)
		.fetch().all()
		.forEach(System.out::println);

 

or use Driver's value types

 

Map<String, Object> values = new HashMap<>();
values.put("list", Values.value(Values.values(1, 2, 3, 4)));

client.query("UNWIND $list as value return value")
		.bindAll(values)
		.fetch().all()
		.forEach(System.out::println);

 

Thanks for giving the response, But In my case, I have a list of maps. Ex. List<Map<String,Object>> value.

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.