# negative count() results

**URL:** <https://forums.percona.com/t/negative-count-results/5268>\
**Category:** Percona Server for MongoDB\
**Created:** [December 7, 2016, 9:02am UTC](https://forums.percona.com/t/negative-count-results/5268 "2016-12-07T09:02:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TGoeller](https://avatars.discourse-cdn.com/v4/letter/t/f0a364/32.png) [@TGoeller](https://forums.percona.com/u/TGoeller)\
**Post date:** [December 7, 2016, 9:02am UTC](https://forums.percona.com/t/negative-count-results/5268/1 "2016-12-07T09:02:29Z")

</div>

We’re experiencing some weird results with indices and count() in PSMDB (PerconaFT engine) on collections with high read/write access.  
At first we got some wrong numbers: count() =\> 3 but real 94 entries.

So we decided to do a reindex() on that collection. After the reindex we get negative counts like e.g. -88 when only 2 documents are in the collection!

There seems something wrong with indices! E.g.

db.reports.count() // Returns 29  
db.reports.find() // Returns 46 entries

db.reports.count({ “count”: { $gte: 0 } }) // Returns 46  
db.reports.find({ “count”: { $gte: 0 } }) // Returns 46 entries  
‘count’ field in a non-index field.

Any ideas what’s wrong? Re-indexing didn’t fix it! Also stats() on that collection returns a negative size:

“ns” : “data.mails”,  
“count” : -88,  
“size” : -2532158,  
“avgObjSize” : 0,  
“storageSize” : 805306368,  
“capped” : false,

Best, Tom

PS: some additional data  
OS: Deb8  
ReplicaSet 3 nodes  
PSMDB 3.2.10-3.0
