MongDB - Query Targeting: Scanned Objects / Returned has gone above 5000

I have…

I’m submitting a…

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

Current behavior

We are getting a lot of the below alert from MongoDB:

"Query Targeting: Scanned Objects / Returned has gone above 5000

The ratio of scanned documents to returned exceeded 5000.0, which typically suggests that un-indexed queries are being run."

Expected behavior

Having an index that avoids this grand scam

Minimal reproduction of the problem


App Name: Squidex hosted in uor Azure Cloud with MongoDB

  • [ ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [X] Cloud version

Version: Squidex


  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

The problem is in the DB


Some time ago, our DBA (SQL Server) adjusted some indexes in MongoDB, but from what we understand, Squidex did not understand these indexes and we even had to delete the index for Squidex to work again.

Can you read this first?

It is only my todo list to write a new storage system for contents where each schema is represented by one collection and each app is one database. But so far I haven’t had the time or funding yet to do so. With this approach it would be easier to create indexes.

1 Like