MongoDB's count() incorrectly returns 0 if a query is given

后端 未结 2 1011
执笔经年
执笔经年 2021-01-03 02:01

Our database is currently running and everything seems to fine. I wanted to do some statistics so I did some standard calls. Basically I wanted the number of some specific d

相关标签:
2条回答
  • 2021-01-03 02:42

    It's probable that this question is related to the following bugs:

    • Interrupted count query returns 0 as count result
    • count command returns zero in some error cases rather than reporting an error with ok:false

    In my case (mongodb 2.0.1) was related to database corruption. See find().count() bug?

    0 讨论(0)
  • 2021-01-03 02:44

    Been a while, but I'm closing this now. But it was a corrupt database. Had to manually move all the items from one database to a new one since a backup stopped when it found the corrupt data, and valid data afterwards wasn't being backed up.

    0 讨论(0)
提交回复
热议问题