Skip to content

Validation error when creating node #165

@matosjoaops

Description

@matosjoaops

I'm trying out some of the sample code inside a docker container (not sure if this is related to the issue, neo4j is also running in a docker container BTW) and I'm getting the following error when I try to create a node:

Error: Not sure how to validate driver on _neode
     at /usr/src/app/node_modules/neode/build/Services/Validator.js:273:15
     at Array.forEach (<anonymous>)
     at /usr/src/app/node_modules/neode/build/Services/Validator.js:247:25
     at Array.forEach (<anonymous>)
     at BuildValidationSchema (/usr/src/app/node_modules/neode/build/Services/Validator.js:165:23)
     at Validator (/usr/src/app/node_modules/neode/build/Services/Validator.js:293:16)
     at /usr/src/app/node_modules/neode/build/Services/Create.js:28:38
     at async connect (file:///usr/src/app/src/index.js:34:5)

This is the code I'm using:

import Neode from "neode";

function msleep(n) {
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, n);
}

async function connect() {
  try {

    const instance = new Neode("bolt://neo4j:7687", "neo4j", "password");
    instance.with({
      Person: instance.model("Person", {
        person_id: {
          primary: true,
          type: "uuid",
          required: true, // Creates an Exists Constraint in Enterprise mode
        },
        payroll: {
          type: "number",
          unique: "true", // Creates a Unique Constraint
        },
        name: {
          type: "name",
          index: true, // Creates an Index
        },
        age: "number", // Simple schema definition of property : type
      }),
    });


    await instance.create("Person", {
      name: "Adam",
    });

    const result = await instance.cypher("MATCH (p:Person) RETURN p");

    console.log(result.records[0]);
  } catch (error) {
    console.log(error);
  }
}

msleep(10000);
connect();

Not sure what I'm doing wrong.
Thanks in advance for any help given.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions