Chapter 3 : user reports

I just use three stages $group, $count, and $limit on comments collections. what should i do next ? is it correct ? if it’s correct what will be the next stage.please give a hint.


Hi @Hamza_23934,

The pipeline seems correct. Now you just need to implement this in the code and run the unit test:

 npm test -t user-report


but the return value from the pipline is undefined, why is that? when i run the test. here is the screenshot shot of console.

Hey @Hamza_23934
From the error response you displayed, I believe the syntax of your pipeline is incorrect. The pipeline is wrapped in 2 sets of square brackets;

It seems when you copied the output from mongo-compass it is the entire pipeline with square brackets. Did you paste this inside the square brackets of const pipeline = []?

Try looking over the syntax and remove and extra []


Hi @natac13,
Thank you sooo much, it’s a big relieve i was stuck on it from yesterday.
it works for me :grin: , i never know that this was the mistake . Thanks for identifying it
Hamza Alam

1 Like


1 Like