helloworld
helloworld

Reputation: 1042

HasAndBelongsToMany relations in Loopback

I am trying to go through the example mention in the documentation for the HasAndBelongsToMany relations. Documentation

For the Assembly and Parts example, the documentation says, it adds a function which can add part to assembly.

assembly.parts.add(part,
  function(err) {
  ...
});

But this adds only a single part to assembly. If I have to add multiple parts, do we have a function for that? I think calling this function in a loop multiple times is not an optimal way to do.

Upvotes: 0

Views: 109

Answers (1)

Sashi
Sashi

Reputation: 2867

I don't think there is a way to add multiple items at once. There seems to be a similar question here. This might help you.

Upvotes: 0

Related Questions