Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect validation on update node #66

Closed
Shubhamnegi opened this issue Jul 13, 2019 · 3 comments
Closed

Incorrect validation on update node #66

Shubhamnegi opened this issue Jul 13, 2019 · 3 comments

Comments

@Shubhamnegi
Copy link

Shubhamnegi commented Jul 13, 2019

Update functions throw a validation error if the values which are being updated doesn't include the properties marked as required in the model. For eg. property a,b are marked as required, then while updating property c, update function throws validation error for a and b as they are marked as required in the model, here I don't wish to update a and b.

@adam-cowley
Copy link
Owner

Do you have any code samples that I can take a look at?

@robotgryphon
Copy link

From basically a fresh install, using ts-node, typescript (latest), dotenv, and neode:

import neode from "neode";

const instance = neode.fromEnv();

instance.model("Test", {
  test_id: {
    primary: true,
    type: "string",
    required: true
  },

  name: {
    type: "string"
  },

  isTest: {
    type: "boolean",
    required: false
  }
});

let run = async () => {
  const model = instance.model("Test");

  let node = await model.create({
    test_id: "node.test.1",
    name: "Test Node",
    isTest: true
  });

  let updatedNode = await node.update({
    name: "Test Node Updated"
  });

  await updatedNode.delete();

  console.debug("Node deleted.");
};

run();

image

@Shubhamnegi
Copy link
Author

Shubhamnegi commented Jul 23, 2019

This is what I did to update node while skipping validation check.
const query = "match(j:Journal) where j.orderId = {orderId} set j+= {properties} return j";
const result = await instance.cypher(query, { orderId: orderId, properties: data });

adam-cowley pushed a commit that referenced this issue Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants