How to populate one to many relationship in mongoose with parent refrencing? How to populate one to many relationship in mongoose with parent refrencing? mongoose mongoose

How to populate one to many relationship in mongoose with parent refrencing?


As mongoDB docs says about $lookup:

Performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for processing.

So no, it's not possible do it accross DBs.

But, as an addition, using Mongo exists db.getSiblingDB() option.

Docs here where says:

Used to return another database without modifying the db variable in the shell environment.

So, this is not a $lookup but is an approach to have another Data Base data.