1

I am creating an API through loopback and using visual database design tool MySQLworkbench.

While I'm creating models in loopback I confused to define keys(primary, foreign and candidate). When I go through loopback documentation it's said to use idInjection. But, I confused how to use it.

Please, anyone, give me guidance to solve this issue

1 Answer 1

2

I'm afraid Loopback accept only "id" as primary key and it's mandatory to build loopback model relations.

The foreign key constraints or indexes setup in your database are not handeled by Loopback.

This job would belong to loopback-connector but it's not a part of the specifications.

The main advantages of working with loopback model relations is that you can have relations between different datasources. For example, when your create a "model A belongs to model B" relations, the datasource of model A can be different than the one of model B ! (and each datasource can use a different connector).

Sorry for my english...

Hope it helps

Sign up to request clarification or add additional context in comments.

1 Comment

2022 and still the same problem, sorry if you got here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.