Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

285
Vistas
Neo4j - passing string parameters through JavaScript driver doesn't work

I am during the process of rewriting queries with already injected values to passing query and params object.

Queries which use ints work fine (I need to use neo4j's int translation):

...
ID(node)=$nodeId
...
LIMIT $fetchLimit
import { int } from 'neo4j-driver'
...
params = {
  nodeId: int(nodeId)
  fetchLimit: int(fetchLimit)
}

In some queries I am searching for strings and I am not using "normal" string search

WHERE node.property=$value       <-- "normal" search
WHERE node.property=~"$value.*"  <-- my search

Passing parameters doesn't work in this case.

I have a feeling that when I pass value: 'foo', neo4j resolves it as below:

WHERE node.property=~"$value.*"
...
value: 'foo'

*(injects parameters)*

WHERE node.property=~"'foo'.*"   <-- these inner quotation marks shouldn't be there

How to pass strings to this query and expect proper results?

(note that I am sure that query is written properly because when I directly inject parameters to query using JS's ${value}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can merge two strings with +. The regular expression after =~ is just a string.

So, working Cypher would be:

WHERE node.property =~ $value + ".*"

Alternatively, you could assemble the expression string in JavaScript:

search = 'foo'
params = {
  value: `${search}.*`
}
WHERE node.property =~ $value
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda