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

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

      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

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

              Created:
              Updated:
              Resolved:
              10 years, 4 weeks, 1 day ago