0

I am having strange issue with sharded mongodb, when selecting data and when doing count.

I have

db.parts.find({"my_key":"123"}); -- I get one result back

but when I do

db.parts.find({"my_key":"123"}).count(); -- count returns 2 results.

I am not sure if data is corrupted or not, what is good way to verify if data is corrupted?

usearch
  • 65
  • 1
  • 13
  • 1
    Use `$group` for counting on sharded clusters. https://docs.mongodb.com/manual/reference/method/db.collection.count/#sharded-clusters. Not sure if you are experiencing the same issue. – s7vr Mar 13 '17 at 19:07
  • 1
    Hi usearch; can you double-check that you are connecting to the mongos process, and not to any individual shard? – Vince Bowdren Mar 13 '17 at 22:27

0 Answers0