let say I have documents
[
{
score : 3,
},
{
score : 1,
},
{
score : 2,
}
]
and an array contain order of score
const array = [2,1,3]
How can I sort documents by order of array
expected result :
[
{
score : 2,
},
{
score : 1,
},
{
score : 3,
}
]