useMasterKey on aggregate

I can’t see where i pass the useMasterKey on a query in my cloud function when using an aggregate. Looking at the typescript definitions it doesn’t seem to allow any more parameters other than the array of pipeline options.

var nfts = await nftsQuery.aggregate(pipeline);

I think that it should be as the second parameter to this function

should be the second argument.

myPlantQuery.aggregate([
        {
          lookup: {
            // ...
          }
        }
], { useMasterKey: true })

Wont allow it, typescript is saying there is only 1 parameter.

This is the definition file:

aggregate<V = any>(pipeline: Query.AggregationOptions | Query.AggregationOptions[]): Promise<V>;

can you ignore that typescript error?

did you try to run that in a cloud function?