In the $sort operator of aggregation, if I specify multiple values based on which to sort, then the subsequent values seem to have no effect in case of a conflicting value. Please refer the screenshot below.
The second field used to sort is
hasMagneticField which has a boolean value, so
true scores over
false. That means
Earth should have shown above
Mars but since the
numberOfMoons value of Mars is more, it comes up. So if a planet with lesser number of moons were to have a value true in the
hasMagneticField field, it will still show lower in result set. Seemingly, the second field will have no effect in the sort order.
Is this correct, or there’s some other way for sort to work.