--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/2702a885-0fce-4e65-a5fb-3a981994b779%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
HasManyThrough ?with an intermediate table friendships like (friendshipid) ,userid, friendid ? which can also be expanded with relationship type etc.?
On Fri, Oct 7, 2016 at 11:29 AM, Brian Duong <b...@eaglit.com> wrote:
This is a very common case:We have an User model, now we want an user make friend with each other.I tried to create a HasAndBelongsToMany like that:I think its is very reasonable but it doesn't work...of course this table UsersUsers was generated by Loopback!It would be perfect is the foreign key is friendId (instead of undefined) and its value is an User ObjectId (instead of String)Please advise, thanks in advance!
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
In essense it's exactly the same as what loopback tries to create automatically but allows you to declare the table yourself so a) you can have friendid instead of undefined (because LB tries to set the column names programmatically and they end up both as UsersID so once is undefined) and b) you can extend the intermediate table with extra metadata such as relationshiptype, date of friendship etc.
On Fri, Oct 7, 2016 at 11:39 AM, Alex Megalokonomos <al...@clockwork.gr> wrote:
HasManyThrough ?with an intermediate table friendships like (friendshipid) ,userid, friendid ? which can also be expanded with relationship type etc.?
On Fri, Oct 7, 2016 at 11:29 AM, Brian Duong <b...@eaglit.com> wrote:
This is a very common case:We have an User model, now we want an user make friend with each other.I tried to create a HasAndBelongsToMany like that:I think its is very reasonable but it doesn't work...of course this table UsersUsers was generated by Loopback!It would be perfect is the foreign key is friendId (instead of undefined) and its value is an User ObjectId (instead of String)Please advise, thanks in advance!
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/0c91ddf0-e2bc-49f6-9fd1-bd6b1e0b6d13%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/77e8d05c-be22-481c-b3f2-3aa5ee77de7a%40googlegroups.com.