Mongo cannot run command count(): failed on : [primary shard]

Error: When using MongoDB sharded cluster 2.6 and php mongo driver,  db.collection.count() contains an $in operator would raise a BadValue error if using assoc array or bad numerical indexed array:

array(‘apple’->’iphone’, ‘nokia’->’winphone’)

array(0->’a’, ‘2’->b)

Solution:

In PHP, use array_values($array) to get the numerical indexed array as input for $in query

Mongo cannot run command count(): failed on : [primary shard]