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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.5
    • Component/s: 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 } )

      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.

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

              Created:
              Updated:
              Resolved: