Truncating a capped collection using the WiredTiger storage engine may not remove the deleted documents from the indexes in the collection.
When running the captrunc command on a capped collection, or when a member of a replica-set does a rollback of such a collection, the removed documents may not be deleted from the collection's indexes, thus leaving the indexes in an inconsistent state. As a result, a query covered by an index may report results that include deleted documents, and queries using an index in general may fail or return incorrect results. Regular deletions as result of exceeding capped collection capacity are not affected by this issue.
To determine if a capped collection is impacted by this issue, users can compare the output of the following commands:
If the results are equal the capped collection is not impacted by this issue. Alternatively, users can compare the nrecords and keysPerIndex fields of the db.cappedcollection.validate() output in the mongo shell; if the values are equal then the capped collection is not impacted.
Users may run the reIndex command on the affected capped collections. This restores consistency in the collection's indexes, but does not prevent the issue from happening again.
MongoDB versions 3.0.0 through 3.0.4 using the WiredTiger storage engine.
The fix is included in the 3.0.5 production release.