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

Can't create relation based on id #41

Open
Techniv opened this issue Sep 11, 2017 · 0 comments
Open

Can't create relation based on id #41

Techniv opened this issue Sep 11, 2017 · 0 comments

Comments

@Techniv
Copy link

Techniv commented Sep 11, 2017

Hi!

Considering this models:

class A extends Model{
  static [Model.schema](){
    return {
      name: Joi.string(),
      ref: Model.hasOne(B)
    };
  }
}

class B extends Model{
  static [Model.schema](){
    return{
      name: Joi.string()
    };
  }
}

Considering I have on nodes in database:

(:B( id:"b1", name: "bar"})

If I create a new A like that:

let a = new A({
  name: 'foo',
  ref: {
    id: 'b1'
  }
});
a.save();

I get this:

(:B {id:"b1", name: "bar"})<--(:A {id:"a1", name:"foo"})-->(:B {id:"b1"})

The NeoDM id well considerate to create the relation but only the NEO_ID is used to determine if the node need to be create or not.

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

1 participant