Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-17458

Update with upsert true with _id 'in' x query does not work in hashed sharded collection

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.6.5
    • Sharding
    • None
    • ALL
    • Hide

      1. Take a sharded collection with shard key: { _id : "hashed"}.
      2. Update like this:

      db.col.update( 
          { _id: { $in: [ 2237296 ] } }, 
          { $set: { l: "lala"}}, 
          { multi: true, upsert: true }
      )

      Show
      1. Take a sharded collection with shard key: { _id : "hashed"}. 2. Update like this: db.col.update( { _id: { $in: [ 2237296 ] } }, { $set: { l: "lala"}}, { multi: true, upsert: true } )

    Description

      We have a sharded collection with shard key: { _id : "hashed"}.
      An update with upsert true fails with

      "does not contain shard key for pattern { _id: "hashed" }".

      This only happens on sharded collections + upsert: true + _id: { $in: [ 2, 3 ] } query.

      if the query is not an in query or upsert is false it works.

      Attachments

        Activity

          People

            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            breitlauch Daniel Breitlauch
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: