How we can perform sorting for nested fields?

"animals" : [
		{
			"Number" : "0114771487",
			"Date" : {
				"$date" : 1655683200000
			},
			"status" : "E0006",
			"lifeTerm" : "0030",
			"netAmt" : 205.77,
			"taxAmt" : 13.7,
			"currency" : "USD"
}
]

in this i need to sort status field by ascending or decending ?

You may sort an array with $sortArray.

Something like:

{ "$sortArray" : { "input" : "$animals" , "sortBy" : { "status" : 1 } } }

actually it is nested field on top of it there are few more fields like
{
human:“1233444”,
goat:“1323”,
“animals” : [
{
“Number” : “0114771487”,
“Date” : {
“$date” : 1655683200000
},
“status” : “E0006”,
“lifeTerm” : “0030”,
“netAmt” : 205.77,
“taxAmt” : 13.7,
“currency” : “USD”
}
]
}
i need to filter status field here???

You should try what I have shared because it will work the same with your updated document.