One of my collections is a list of operations (or tasks) with some status. For example, a list of documents can look like this
{
_id: '57befe57fc956d2e3252890c',
task: 'Go buy milk',
status: 'pending'
},
{
_id: '57befe5efc956d2e3252890d',
task: 'Cook dinner',
status: 'complete'
},
{
_id: '57befe5efc956d2e3252890e',
task: 'Play games',
status: 'new'
}
I want to sort this list based on a their status, where new > pending > complete.
How can I do that with MongoDB without having to create an extra field? I am asking as in my case the sorting order may be pre-configured (i.e. users could have their preferences to pending > new > complete for example)