How to $hint a $lookup pipeline

Is it possible to set a $hint in a pipeline in a lookup?

{
    "$lookup": {
      "from": "events",
      "let": {
        "cId": "$_id"
      },
      "pipeline": [
        {
          "$match": {
            "$expr": {
              "$and": [
                {
                  "$eq": [
                    "$contact_id",
                    "$$cId"
                  ]
                }]}
        }},
        {
          "$group": {
            "_id": "$contact_id",
            "609148080548ab43fb3c9c83": {
              "$sum": {
                "$cond": [
                  {
                    "$and": [
                      {
                        "$eq": [
                          "$channel",
                          "form"
                        ]
                      },
                      {
                        "$eq": [
                          "$event",
                          "submitted"
                        ]
                      },
                      {
                        "$eq": [
                          "$form_id",
                          ObjectId( "6000194aae91a5ea3fa9975b" )
                        ]
                      }
                    ]
                  },
                  1,
                  0
                ]
              }
            }
          }
        }
      ], 
      "as": "events"
    }
  }

In the lookup above I would like to have a hint like this

“$hint”, { contact_id: 1, channel: 1, form_id: 1, event: 1 }

What is the correct syntax?

4 Likes