Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

312
Visualizações
Neo4j CREATE 2022+ syntax Node.js

What is the currently acceptable syntax for sending a CREATE script from Node.js to Neo4j in 2022 and after?

I am getting several errors trying to pass in dynamic props from form input fields.

I need to create a new record from my form inputs using Node.js.

This is an example of a syntax that is no longer accepted:

app.post('/books/add', function(req, res){
  var title = req.body.title;
  var year = req.body.year;

    session
    .run('CREATE(n:Book {title: {paramTitle}, year: {paramYear}}) RETURN n:title', {paramTitle:title, paramYear:year})
    .then(
      function(result){
        res.redirect('/');
        session.close();
      }
    )
    .catch(function(error){
      console.log(error)
    });

  res.redirect('/');
});

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The syntax you're using is deprecated. Parameters are now identified with the dollar symbol $ instead of curly brackets {}. That means you need to update your query to:

.run(
    'CREATE(n:Book {title: $paramTitle, year: $paramYear}) RETURN n:title',
    {
        paramTitle: title, 
        paramYear: year
    }
)

See relevant documentation here: https://neo4j.com/docs/cypher-manual/current/syntax/parameters/

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda