Is it possible to aggregate $ lookup between two databases in MongoDB?
It is not possible to request the use of search in two different db.
$ lookup in mongodb support Performs a left outer join in an insecure collection in the same database.
{
$lookup:
{
from: <collection to join>,
localField: <field from the input documents>,
foreignField: <field from the documents of the "from" collection>,
as: <output array field>
}
}
We can use getSibling("dbname")to request another db from one db
db.getSiblingDB('test').foo.find()
- - MongoDB