SERVER-13702 Commands without optional query may target to wrong shards on mongos

(cherry picked from commit bd1a02385378ee50a33db7c255217c050cc74192)

SERVER-13702 Add JS tests for shard targeting.

(cherry picked from commit e986b037f1301fae63938dc9bd933ff8ac25b7d6)