Final: Question 4 $sortByCount within $facet

Your answer is incorrect.
$facet does accept $sortByCount as a sub-pipeline stage.

I’ve run this task and received an error:
"errmsg" : "the sortByCount field must be defined as a $-prefixed path or an expression inside an object"

I checked 3 correct items:
< deleted >

Please check it

@Pavlo_97531

First of all, please follow Forum guidelines and do not post code, answers or potential answers here. Thanks.

You did not get the correct answers. Try again. The item you mention has nothing to do with your incorrect choices. Good luck.

$sortByCount cannot be used within $facet stage

I had to choose all items that throw errors.
I think this answer is correct too, because it throws error:
the sortByCount field must be defined as a $-prefixed path or an expression inside an object
But in your answer this item is marked ‘it doesn’t throw error’

@Pavlo_97531

You misunderstand the question. The issue isn’t to mark all items that throw an error; the issue is to identify what the error is and why it’s thrown. So you must determine whether the $sortByCount field can be used within a $facet stage or not. In other words, an answer does NOT mark the item “it doesn’t throw an error”; it asks WHY the error is thrown. Try again.

OK, in my first answer I checked 3 answers.
After that, I tried another answer and next 2 attempts. I spent all attempts.

I checked $sortByCount cannot be used within $facet stage.
We said to me that $sortByCount can be used within $facet stage.
Right?

@Pavlo_97531

Yes; check the documentation here under “Behavior”.