There is a field where there is an array stored. I want to sort the documents based on the array length of that field.
Sample documents
document 1 = {
"countryCodes" : ["US","UK","UA","IN"]
}
document 2 ={
"countryCodes" : ["FR","SU","UG","UK","US"]
}
So, up on sort, the results should be showing document 2 first and then document 1.