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

Many to many association problem #25

Open
aikken opened this issue May 16, 2017 · 0 comments
Open

Many to many association problem #25

aikken opened this issue May 16, 2017 · 0 comments

Comments

@aikken
Copy link

aikken commented May 16, 2017

Hello,

i'am trying to use a many to many association with this adapter.
I use the sample with User and Pet models. One user can have many pets and one pets can have many owners

Model User

module.exports = {
  attributes: {
    name:{
      type:'string'
    },
    pets:{
      collection:'pet',
      via:'owners',
      dominant: true
    }
  }
};

Model Pet

  attributes: {
    name:{
      type:'string'
    },
    owners:{
      collection:'user',
      via:'pets'
    }
  }
};```

If i create a new User with no pet associated it works for the creation, but if i go to : http://localhost:1337/user/1 
in order to get this user i get this error 

> Details:  Error: SELECT "pet"."name", "pet"."id", "pet"."createdAt", "pet"."updatedAt" FROM "pet" AS "pet"  WHERE "pet"."id" IN )  LIMIT 30 - SQLITE_ERROR: near ")": syntax error

If i change the adapter by localDiskDb, it works with no problem.
If i associate a pet to this user, it works with no problem.
Thanks for your help :-)
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