The database has around 100k collections. Each document has an id field and multiple array fields that itself have multiple values.
The usecase is to get the id field and no. of elements in these arrays of all the collections and return the data.
Right now what i am doing is using a project stage and size operator to achieve the above. However it takes a lot of time. What can be done to reduce the time taken for this usecase
Hey @chris Thank you for your response. I here was trying to optimse my query, but your advice definetly provided a new way to approach this issue. I will be implementing a server side functions and checking the performance again