Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-3039

Document the limitation of removing a single document in sharded the collection

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • v1.3.3
    • manual
    • 4
    • true

    Description

      If you delete only one document (using justOne option) without querying by _id, like so:

      db.collection.remove({a:1}, true)

      you'll get this assertion:

      can only delete with a non-shard key pattern if can delete as many as we find

      This is a restriction for sharded collections. See source code:
      https://github.com/mongodb/mongo/blob/v2.4/src/mongo/s/strategy_shard.cpp#L1153

      A warning/note should be added here:
      http://docs.mongodb.org/manual/reference/method/db.collection.remove/

      This limitation still exists in 2.6

      Attachments

        Activity

          People

            sam.kleinman Sam Kleinman (Inactive)
            gianfranco Gianfranco Palumbo
            Jonathan Dahl Jonathan Dahl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8 years, 13 weeks, 4 days ago