Is it possible to do a $lookup aggregation between two databases in Mongodb?

Yes just read the following mongodb doc:

In Atlas Data Lake, $lookup can be used to perform a join of collections from different databases.

https://docs.mongodb.com/datalake/reference/pipeline/lookup-stage


Is it possible to do a $lookup aggregation between two databases in Mongodb?

It is not possible to query using lookup in two different db's. $lookup in mongodb supports Performs a left outer join to an unsharded 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 query another db from one db

db.getSiblingDB('test').foo.find()

Reference - MongoDB cross database query