- 
    Type:
Question
 - 
    Resolution: Done
 - 
    Priority:
Major - P3
 - 
    None
 - 
    Affects Version/s: None
 - 
    Component/s: Sharding
 - 
    None
 
- 
        None
 
- 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 - 
        None
 
To perform "upsert" operation on a sharded MongoDB cluster, the query MUST exactly match the shard key.
For example:
update( {a:1, b:2}, { $setOnInsert { c : 3, d : 4}}, { upsert: true})
The above update does not work if the shard is key is for example
{a: 1, _id: 1}. 
Is this the designed behavior? If so, why cannot I not find the detailed example or warning for this? Since the shard kay cannot be modified, this is causing huge problems. It just completely broke our migration from a stand-alone server to the sharded cluster.
- is related to
 - 
                    
SERVER-4000 command to change shard key of a collection
-         
 - Closed
 
 -