Currently using MongoDB and in need of assistance with making a query. Specifically, I would like to perform a search on my user collection that includes a field named "country".
For example:
{
"name" : "John",
"country" : "FR"
}
For instance, I am interested in retrieving 30 users from France. If there are at least 30 French users in the database, then simply return those 30. However, if there are fewer than 30 (let's say 12) users from France, then I would like to retrieve all 12 French users along with an additional 18 users, regardless of their country of origin, to make up the total of 30.
I am curious whether this can be achieved through a standard query or if I need to resort to utilizing MapReduce.