Able to delete document in capped collection in MongoDB 7.0.20

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS:Windows
    • Storage Execution
    • Storage Execution 2025-06-09
    • None
    • 3
    • TBD
    • None
    • None
    • None
    • None
    • None
    • None
    • 0

      Title: deleteOne() unexpectedly allowed on capped collection in MongoDB 7.0.20

      Environment:

      • MongoDB version: 7.0.20
      • Shell: mongosh
      • Database: final_mongo

      Steps to Reproduce:
      {{db.createCollection("testCap",

      { capped: true, size: 1024 }

      )

      db.testCap.insertMany([

      { msg: "X" }

      ,

      { msg: "Y" }

      ])

      db.testCap.deleteOne(

      { msg: "X" }

      ) // ❌ Unexpectedly succeeds}}
      Expected Behavior:
      According to MongoDB’s official documentation:

      “You cannot delete documents from a capped collection.”
      Source: https://www.mongodb.com/docs/manual/core/capped-collections/#restrictions

      The deleteOne() call should fail with a WriteError.

      Actual Behavior:
      The deletion succeeds:
      {{

      { acknowledged: true, deletedCount: 1 }

      }}
      And the document is removed.

      Impact:
      Applications relying on append-only write behavior (e.g., logs or real-time data buffers) may silently lose data. This violates the purpose of capped collections and introduces data integrity risks.

      Request:
      Please clarify whether this is:

      • An intentional change in MongoDB 7.0+
      • Or an unintended regression from earlier versions

            Assignee:
            Louis Williams
            Reporter:
            Ankit Jain
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: