For the following sorted list:
{
sorted_list : [{name : <string>,score : <Number>}]
}
What are the complexities of the following commands (in 'O' notations)?
Find:
collection.find( { _id: 1}, { sorted_list: { $slice: [ <skip>, <limit> ] } } )
Insert:
collection.update(
{ _id: 1 },
{
$push: {
sorted_list: {
$each: [ { name: 3, score: 8 }, { name: 4, score: 7 }, { name: 5, score: 6 } ],
$sort: { score: 1 }
}
}
}
)
Remove:
collection.update({"sorted_list.name": name},{ $pull: { "sorted_list.name": <name> } },{ multi: true });
EDIT
Let's assume ther following index exists:
{ "sorted_list.name" : 1}