Graphql custom resolver with aggregate isn't working on the client side

Noob here. I created a custom resolver on graphql and the function for that resolver filters and counts each type of one field. This is the code:

result = await collection.aggregate([
      { $match: { post_id: input.post_id} },
      { $group: { _id: '$unicode', count: { $sum: 1 } } },
      { $project: { unicode: '$_id', count: 1, _id: 0 } }
    ]).toArray();

This function works when I test it under the console with non-system users and also on graphiql. But when I fetch the data from the client side it is giving this error.

Error aggregating reactions: FunctionError: intermediate aggregation document does not satisfy schema: reason=“could not validate document: \n\t(root): user_id is required\n\t(root): post_id is required\n\t(root): _id is required”; code=“SchemaValidationFailedRead”; untrusted=“read not permitted”; details=map

I don’t see the reason for requiring user_id and _id as I am not using to query or filter the collection. Appreciate any help

Did you ever find the solution to this? I’ve encountered the same thing after updating my schema to include require fields. I can retrieve single documents without issue but my custom resolver fails.