jamesfer / cypher-query-builder

An flexible and intuitive query builder for Neo4j and Cypher.
http://jamesfer.me/cypher-query-builder/index.html
MIT License
104 stars 22 forks source link

Neo4j 4.0.x Limit and Skip clauses now expect params to be Neo4j.int #159

Closed ChristopheVandePoel closed 3 years ago

ChristopheVandePoel commented 3 years ago

I refer to the following issue on the driver repo: https://github.com/neo4j/neo4j-javascript-driver/issues/547

We are in the progress of upgrading our Neo4j to 4.x and ran into the above error when using .limit(10) and .skip(10) as provided by this repository.

Steps to reproduce Against a Neo4j 4.x, run:

     query.match([node(name, '')])
               .return(name)
               .limit(10)

expected result: first 10 records to be returned. actual result: error thrown LIMIT: Invalid input. '10.0' is not a valid value

current workaround replace all query.limit() and query.skip() calls with a query.raw() value

query.raw(`SKIP $skip`, { skip: neo4j.int(this.options.skip) })

Proposed fix Replace the implementation of the limit and skip with a compatible version:

    this.amountParam = this.addParam(neo4j.int(amount), 'skipCount');

This should be bw/fw compatible, but might result in cypher snapshots during tests (like with ours) to fail.

jamesfer commented 3 years ago

Hey there. Thanks for the detailed bug report. I've created a fix and should be able to deploy it soon.

jamesfer commented 3 years ago

:tada: This issue has been resolved in version 6.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: