I have an array which holds information about availability and some other info about products. Instead of returning the all Data in Array i want to only return docs in array where the avail = true and then return all sorted by the id.
[
{
"id": 5,
"avail": true,
"name": "product A",
"qty": 18
}, {
"id": 9,
"avail": false,
"name": "product B",
"qty": 0
}, {
"id": 7,
"avail": true,
"name": "product C",
"qty": 3
}, {
"id": 1,
"avail": true,
"name": "product D",
"qty": 47
}, {
"id": 4,
"avail": false,
"name": "product E",
"qty": 0
}
]