[SERVER-8818] Upsert of a document with shard key results in failure as opposed to a succesful insert Created: 01/Mar/13  Updated: 10/Dec/14  Resolved: 01/Apr/13

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 2.4.0-rc1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Sridhar Nanjundeswaran Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

2.4.0-rc1 2008R2plus build on Windows 7


Attachments: File shardkeyUpsert.js    
Operating System: ALL
Steps To Reproduce:

Run mongo shardkeyUpsert.js

Participants:

 Description   

Expect the attach js to result in an insert but it errors out as
assert: [null] != ["Can't modify shard key's value. field: ukey: -111.0 collecti
on: _unknown_name_.collSharded"] are not equal : undefined
Error: Printing Stack Trace
at printStackTrace (src/mongo/shell/utils.js:37:7)
at doassert (src/mongo/shell/assert.js:6:1)
at Function.assert.eq (src/mongo/shell/assert.js:32:1)
at c:\Users\sridhar\Desktop\shardkeyUpsert.js:52:8
Fri Mar 01 14:23:47.367 JavaScript execution failed: [null] != ["Can't modify sh
ard key's value. field: ukey: -111.0 collection: _unknown_name_.collSharded"]
are not equal : undefined at src/mongo/shell/assert.js:L7



 Comments   
Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ]

this is not a true upsert

$set on shard keys is disallowed entirely, which I believe ie clearer and simpler.

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