M121 The aggregation framework. Chapter 3 Lab 1

Hi,
whenever I use the $stdDevSamp operator, in the aggregation, query, I get a null for the value.

Thanks.
Apurva A Kunkulol.

We need a little bit more context to be able to help.

Could you please come up with an example, which does not give lab answer, that would show how you use it?

I’ll give you a small part of the query I made.
db.movies.aggregate([{... "deviation": {$stdDevSamp: "$imdb.rating"}}])

That looks right. My guest is that no or only one document reaches that stage. Replace the $stdDevSamp:… accumulator with $sum:1 to see how many documents from the previous stage are passed down to the group stage.

1 Like