2 / 2
Apr 2024

I have an application that stores URL locations from aws into my mongodb collections which has been working fine. Suddenly documents started getting deleted without anyone dispatching the actions. I have checked but there are no TTL indexes as you can see in the image attached. What could be causing this? This is causing a big issue at the moment.

Now the issue is this, in two new collections when:

  • User A uploads their documents going to these two collections (Status All Good)
  • User B uploads their documents (All of User A’s documents in these two collections are deleted and User B’s documents are retained)
  • User C uploads their documents (Sometimes All of User B’s documents are deleted sometimes one is retained and only User C’s documents are retained)

What I have done:

  • Created a middleware that checks document ownership preventing unauthorized deletion
  • Created an audit log feature that logs all delete actions for these collections
  • Checked if there exists a TTL index on either of these collections the only index is the id