A
A
Artur Lastname2021-02-17 19:01:05
Node.js
Artur Lastname, 2021-02-17 19:01:05

How to properly join tables with mongoose(mongo)?

The problem is this:
There are 2 tables with data, one is `teams` : The other is
602d3a197b076980970652.png
`roster` :
602d3a3ea2800673646600.png

There is `roster.team_id` which holds an int.
And here I actually make a request for getting, waiting to see `teams`, and its `roster` :

let qq = await Team.find({_id: 271}).populate('Roster');
return qq;

But in the response, only information about the team comes to me:
602d3ce433967242019074.png
Well, here is an example that shows that there is data in the `roster` table with such a `team_id`:
602d3d7505db0271467562.png

Where am I wrong?)).
Perhaps the problem is that I have overwritten `_id` for each collection, but this seems to be not prohibited, judging by the manuals that I found ....

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question