Can you do $lookup joins on a sharded cluster?

I know we can use aggregations on sharded clusters. But is it possible to use $lookup and $graphLookup joins on sharded clusters?

Yes, you can. Condition is $lookup stage require running on the database’s primary shard and only on unsharded collection.

Let me know if you need more details.


Thank you. To clarify,

  1. You can use $lookup on a sharded cluster (db must be on primary shard).

  2. You cannot use $lookup on a sharded COLLECTION.

Thats correct! :slight_smile:


1 Like