Your tests then eliminate issues with code logic. Good.

This last observation points to the direction of type mismatched between the stored value and the runtime type of the variable collectionId. For example, if the collectionId field is stored as a number, then the runtime type of the variable collectionId must also be a number. A frequent error, is that we get the variable value from a HTML form and the values are strings unless converted.

So what I suspect is that you do not obtain the value of collectionId using the same mean in the find vs the aggregate case. So it works with find because the runtime type of collectionId is correct while it is not correct for aggregate. For example, it could be the case that for find you do:

and for aggregate you do:

Something like

might be sufficient to make it work.