Hi Cuong,
In order to access a specific array element you need to use $arrayElemAt operator.
In the above code, $slice operator returns a subarray and the $lt operator then compares two subarrays so it eventually works as expected.
But in this code $lt operator now has to compare a array with a normal value so it fails.
The proper way of doing this would be -