[SERVER-923] With upserts key can be in query or mod Created: 19/Jan/10  Updated: 12/Jul/16  Resolved: 14/May/10

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

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

These will work correctly:
upsert({_id:FOO},

{key:BAR, other:1}

)
upsert({_id:FOO, key:BAR}, {$set: {other: 1}})
upsert({_id:FOO, key:BAR},

{other:1}

) // converted to the first example.

This must fail:
upsert({_id:FOO, key:BAR},

{key:BAZ}

)

This can cause dup IDs but wont fail until/unless we get unique indexes working across shards:
upsert({_id:FOO, key:BAR}, {$set: {other:1}})
upsert({_id:FOO, key:BAZ}, {$set: {other:1}})



 Comments   
Comment by Mathias Stearn [ 14/May/10 ]

Decided not to support 3rd case. Asserts if using a non-modifier update and key isn't in object.

Comment by Mathias Stearn [ 08/Feb/10 ]

everything working but the 3rd case. deferring for now since it would behave differently under sharded and non-sharded environments

Comment by auto [ 19/Jan/10 ]

Author:

{'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}

Message: better handling of sharded upserts. SHARDING-72

more update fixes coming after 1.3.1
http://github.com/mongodb/mongo/commit/19732ca8f936dac45e52b62757a4437a02607f57

Generated at Thu Feb 08 02:55:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.