Skip to content
Advertisement

Multiple populates – mongoosejs

Just a simple query, for example with a double ref in the model.

Schema / Model

JavaScript

Query

JavaScript

I already tried something like

JavaScript

In fact only one of the populates works.

So, how do is get two populates working ?

Advertisement

Answer

You’re already using the correct syntax of:

JavaScript

Perhaps the meal ObjectId from the order isn’t in the Meals collection?

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement