Is there a way to hint to use an index during the $lookup stage? For example, this $lookup just uses the default {_id: 1} index and I want to use the index I have on the $match itself
$lookup: {
from: "cattle",
let: { cattleIds: "$cattleIds", groupId: "$groupId" },
pipeline: [
{ $match:
{ $expr:
// This still doesn't match the index, only goes for {_id: 1}
{ $and: [
{ $eq: ["$groupId", "$$groupId"] },
{ $eq: ["$standing.status", "alive"] },
{ $in: ["$_id", "$$cattleIds"] },
] }
}
},
as: "cattles"