[SERVER-17458] Update with upsert true with _id 'in' x query does not work in hashed sharded collection Created: 04/Mar/15  Updated: 10/Mar/15  Resolved: 10/Mar/15

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.6.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Daniel Breitlauch Assignee: Ramon Fernandez Marina
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-14309 can't do non-multi update or upsert w... Closed
Operating System: ALL
Steps To Reproduce:

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 }
)

Participants:

 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.



 Comments   
Comment by Andy Schwerin [ 10/Mar/15 ]

This is essentially a duplicate of SERVER-14309. The only potential specialization is whether or not a single-entry $in could be treated like equality for purposes of upsert document construction.

Comment by Andy Schwerin [ 06/Mar/15 ]

ramon.fernandez, can you try the reporter's repro on the 3.0 branch? The targeting code with respect to upserts changed during the development of 3.0? This problem may have been resolved by the work done for SERVER-14973. Particularly, this commit changed how we validate that upserts meet the shard targeting requirements.

Generated at Thu Feb 08 03:44:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.