$search must be the first stage of any pipeline it appears in

We love the atlas search but are there any plans to relax this restriction that it must be the first stage? We run multi-tenant setups and if we could add a match before the search it would improve performance a lot.

Depending on how you are handling multi-tenancy, you can filter with the compound operator in the $search pipeline stage.

For example:

$search: {
  compound: {
    // You can use `should`, `must`, or `mustNot` as needed for your actual query in here
    filter: [{ // You can filter on multiple things in here
      equals: {
        path: '_tenantIdFieldHere',
        value: ObjectId('tenant id'),