[SOLVED] MongoCountCollection.GetOrAddAsync doesn't work for Collections greater than 5000 Documents

I checked the Code from this old Bug Total on contents view doesn't match the number of paged results
There is still something not working

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • Bug report
  • Performance issue
  • Documentation issue or request

Current behavior

TotalCount for Collections greater than 5000 Documents is not updated. I checked the MongoDB Total Count Caches, they are not updating. For all collections with less than 5000 Documents it works.

Expected behavior

FireAndForget Task should be replaced by a Background Worker or Hardcoded Limit should be Extended to say 100_000 Documents

Minimal reproduction of the problem

Create a Schema with more than 5000 Documents and then insert another document, Cached Key is not updated

Environment

  • Self hosted with docker
  • Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: 7.15.0.0

I don’t understand this task to be request to be honest. What kind of error do you get. Do you see something in the logs?

It also sounds like an old bug.

We have multiple schemas in different apps.

In all Schemas with more than 5_000 entries the total count is not updated when we insert a new entry

So after reading the code I found the magic 5_000 constant. The FireAndForget thing is not working.

And no log entries when this happens

I can also send you a backup of an app with this problem and you can try it out with this data

1 Like

Hi Sebastian,
can I send you a backup of the Data where you can reproduce the error?
I would really love to fix this old bug, it still exists.

Of course, it needs to be fixed.

Do you have the logs somewhere? Because if there is an exception, it is actually logged.

Something like

Failed to update count for collection 'CountCollection' 

I have tested 50.000 items with the CLI and I cannot verify the problem.

Can you please restore the Backup I sent you via PM, the problem can be seen there.

Sorry, I was just blind. It has nothing to do with your backup and I have not seen it in my local test either. The update statement was just wrong.