Is it possible to do a $lookup aggregation between two databases in Mongodb?
For example:
I have a collection, called "bookshelves" in a database(just call it aaa). But have another collection, called "picture_books" in another database (just call it bbb).
I want to do like this:
db.bookshelves.aggregate([{$match: {"child_id":262}},{$lookup: {from: "picture_books", localField: "bookshelfable_id", foreignField: "book_id", as: "picture_books"}}]).pretty()
it doesn't work.
Mongodb says
"Performs a left outer join to an unsharded collection in the same database to filter in documents from the “joined” collection for processing."
so, How can i solve it?