Fix for SERVER-2801

Counting distinct values without needing to fetch them all to the client (also avoids document limit).

Finally it's working correctly. I have deployed it in my system. Please, verify and pull in.