SERVER-12642 validates input to the distinct command

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
Merge remote-tracking branch 'upstream/master'