cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Why this query doesn't work in bolt session?

gigauser
Graph Buddy
result, err = session.Run("with $inputword as list match (p:Person) where p.name in list return p.age as ages",
	map[string]interface{}{"inputword": "['name1', 'name2']"})

The query work well in web browser but not in Go program.

  • Go
2 REPLIES 2

Not 100% sure, but I believe you need to do something like this:

cypher := `with $inputword as list match (p:Person) where p.name in list return p.age as ages`
result, err = session.Run(cypher, map[string]interface{}{
	"inputword": []string{"name1", "name2"},
})

@gigauser, In the code you've pasted, you're passing inputword as a string - not a list; that wouldn't work as intended.

You can however, send them as a slice in go so that they're encoded as lists as intended.

session.Run("with $inputword as list match (p:Person) where p.name in list return p.age as ages", map[string]interface{}{"inputword": []string{ "name1", "name2" }})