Unknown column 'Recipe.userId' in 'field list' in typeorm

Viewed 87

enter image description here

Why i get this error? userId is come from where?

This my user.entity.ts enter image description here

And it's my recipe.entity.ts enter image description here

2 Answers

change query Receipe.userId to Receipe.user: {id: ...}

Change your query with the same name in your Entity, in your case Recipe.user instead of Recipe.userId.

Even if in the database the foreign key is called userIdrefer to your entity.

Hope this helps

Related