Creating a hasAndBelongsToMany relation with additional fields
up vote
0
down vote
favorite
Loopback 3
I have two models, Contacts
and Listings
. I need to link both of them together through a hasAndBelongsToMany
model, but I need to include a "through model".
Basically, each relation needs to include some metadata, such as the "role" of the relation. So, each Contact can have an infinite amount of Listings (and vice-versa), and each relation can have a few fields detailing the purpose of the relation.
The goal is to act just like the standard hasAndBelongsToMany
relation, but I also need this additional data returned with each REST request.
Is there any way to accomplish this?
javascript node.js loopbackjs
add a comment |
up vote
0
down vote
favorite
Loopback 3
I have two models, Contacts
and Listings
. I need to link both of them together through a hasAndBelongsToMany
model, but I need to include a "through model".
Basically, each relation needs to include some metadata, such as the "role" of the relation. So, each Contact can have an infinite amount of Listings (and vice-versa), and each relation can have a few fields detailing the purpose of the relation.
The goal is to act just like the standard hasAndBelongsToMany
relation, but I also need this additional data returned with each REST request.
Is there any way to accomplish this?
javascript node.js loopbackjs
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Loopback 3
I have two models, Contacts
and Listings
. I need to link both of them together through a hasAndBelongsToMany
model, but I need to include a "through model".
Basically, each relation needs to include some metadata, such as the "role" of the relation. So, each Contact can have an infinite amount of Listings (and vice-versa), and each relation can have a few fields detailing the purpose of the relation.
The goal is to act just like the standard hasAndBelongsToMany
relation, but I also need this additional data returned with each REST request.
Is there any way to accomplish this?
javascript node.js loopbackjs
Loopback 3
I have two models, Contacts
and Listings
. I need to link both of them together through a hasAndBelongsToMany
model, but I need to include a "through model".
Basically, each relation needs to include some metadata, such as the "role" of the relation. So, each Contact can have an infinite amount of Listings (and vice-versa), and each relation can have a few fields detailing the purpose of the relation.
The goal is to act just like the standard hasAndBelongsToMany
relation, but I also need this additional data returned with each REST request.
Is there any way to accomplish this?
javascript node.js loopbackjs
javascript node.js loopbackjs
asked Nov 10 at 14:29
Michael Cerne
11
11
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53239937%2fcreating-a-hasandbelongstomany-relation-with-additional-fields%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password