Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9147231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:56:15+00:00 2026-06-17T10:56:15+00:00

I am having trouble using the IN operator in a Cypher query, using the

  • 0

I am having trouble using the IN operator in a Cypher query, using the embedded Java API. It would appear that you are unable to utilize the IN operator with an identifier other than the entity(ies) retrieved in the start clause.

For example, here is my query:

start n=node(someLongNodeId) 
match n--m 
where m.gnid? IN [\"someStringId\",\"otherStringId\"] 
return m

I can utilize the IN operator when filtering on a property of n, but it fails with the following exception when I execute the above query and attempt to call hasNext() on the Iterator returned from columnAs("m"):

Exception in thread "main" java.lang.RuntimeException
    at org.neo4j.cypher.internal.pipes.matching.MiniMap.newWith(ExpanderStep.scala:172)
    at org.neo4j.cypher.internal.pipes.matching.MiniMap.newWith(ExpanderStep.scala:155)
    at org.neo4j.cypher.internal.commands.InCollection$$anonfun$isMatch$1.apply(InCollection.scala:39)
    at org.neo4j.cypher.internal.commands.InCollection$$anonfun$isMatch$1.apply(InCollection.scala:38)
    at scala.collection.LinearSeqOptimized$class.exists(LinearSeqOptimized.scala:79)
    at scala.collection.immutable.List.exists(List.scala:45)
    at org.neo4j.cypher.internal.commands.AnyInCollection$$anonfun$seqMethod$2.apply(InCollection.scala:71)
    at org.neo4j.cypher.internal.commands.AnyInCollection$$anonfun$seqMethod$2.apply(InCollection.scala:71)
    at org.neo4j.cypher.internal.commands.InCollection.isMatch(InCollection.scala:38)
    at org.neo4j.cypher.internal.commands.And.isMatch(Predicate.scala:83)
    at org.neo4j.cypher.internal.pipes.matching.FilteringIterable$FilteringIterator.spoolToNextInLine(FilteringIterable.scala:55)
    at org.neo4j.cypher.internal.pipes.matching.FilteringIterable$FilteringIterator.<init>(FilteringIterable.scala:34)
    at org.neo4j.cypher.internal.pipes.matching.FilteringIterable.iterator(FilteringIterable.scala:72)
    at org.neo4j.cypher.internal.pipes.matching.FilteringIterable.iterator(FilteringIterable.scala:27)
    at scala.collection.JavaConversions$IterableWrapperTrait$class.iterator(JavaConversions.scala:557)
    at scala.collection.JavaConversions$IterableWrapper.iterator(JavaConversions.scala:583)
    at scala.collection.JavaConversions$IterableWrapper.iterator(JavaConversions.scala:583)
    at org.neo4j.kernel.impl.traversal.TraversalBranchWithState.expandRelationshipsWithoutChecks(TraversalBranchWithState.java:70)
    at org.neo4j.kernel.impl.traversal.TraversalBranchImpl.expandRelationships(TraversalBranchImpl.java:104)
    at org.neo4j.kernel.impl.traversal.StartNodeTraversalBranch.next(StartNodeTraversalBranch.java:47)
    at org.neo4j.kernel.impl.traversal.AsOneStartBranch.next(AsOneStartBranch.java:100)
    at org.neo4j.kernel.PreorderDepthFirstSelector.next(PreorderDepthFirstSelector.java:52)
    at org.neo4j.kernel.impl.traversal.TraverserIterator.fetchNextOrNull(TraverserIterator.java:65)
    at org.neo4j.kernel.impl.traversal.TraverserIterator.fetchNextOrNull(TraverserIterator.java:34)
    at org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55)
    at scala.collection.JavaConversions$JIteratorWrapper.hasNext(JavaConversions.scala:574)
    at scala.collection.Iterator$$anon$21.hasNext(Iterator.scala:371)
    at scala.collection.Iterator$$anon$21.hasNext(Iterator.scala:371)
    at scala.collection.Iterator$$anon$22.hasNext(Iterator.scala:388)
    at scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:334)
    at scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:334)
    at org.neo4j.cypher.PipeExecutionResult.hasNext(PipeExecutionResult.scala:138)
    at scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:334)
    at scala.collection.Iterator$$anon$19.hasNext(Iterator.scala:334)
    at scala.collection.JavaConversions$IteratorWrapper.hasNext(JavaConversions.scala:562)
    at com.awesomecompany.data.neo.NeoTestDriver.performBidirectionalQuery(NeoTestDriver.java:122)
    at com.awesomecompany.data.neo.NeoTestDriver.main(NeoTestDriver.java:44)

Am I correct in my assumption that you cannot use the IN operator on something other than n in my example? Is this a bug, or is this by design?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T10:56:17+00:00Added an answer on June 17, 2026 at 10:56 am

    I wanted to answer my own question, in case other people are having similar issues. There are a couple things that I want to adress in reference to the above example:

    Per this discussion in the neo4j Google Group forum

    • I added the HAS() function to the WHERE clause
    • I also changed the array values to use a single quote (') instead of the previous double quotes

    So my new example query looks like this:

    start n=node(someLongNodeId) 
    match n--m 
    where HAS(m.gnid) AND m.gnid IN ['someStringId','otherStringId'] 
    return m
    

    This worked as expected.

    After making the above edits, I converted my query to use parameters (which if JDBC has taught me anything, is the correct way to perform queries like this). That query looked like this:

    start n=node({nodeId}) 
    match n--m 
    where HAS(m.gnid) AND m.gnid IN {otherIds}
    return m
    

    This also worked correctly.

    The IN operator is not terribly well documented at the moment, which is understandable since it is fairly new to the neo4j project, but I wanted to make sure this was answered in case anybody else is having similar troubles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody having trouble using AVFoundation with GC ON??? What I am experiencing is that
Having trouble with using ternary operator. ... char symbol = str_base[i]; int count =
I'm having some trouble with using the conditional operator to get a reference to
I'm having trouble using my sort operator since I need to sort only the
I am having trouble using the //TODO flag. When I put the //TODO comment
I'm having trouble using jQuery.ajax() to post a gist to Github. The gist is
I am having trouble using the ABPersonViewController with RubyMotion. The error I'm getting is
I'm having trouble using Short2 for the (x,y) positions in my vertex data. This
I'm having trouble using python to write strings into a file: (what I'm trying
I'm having trouble using the new async/await tools in c#. Here is my scenario:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.