Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80307

Allow findAndModify to update shard key without specifying full shard key in the query

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sharding NYC 2023-09-04

      Currently this command fails:

      db.customers.findAndModify(
         {
           query: { "username" : "valenciajennifer" },
           update: { "address": "Unit 104711 Box 4089 DPO AA 57348" },
           upsert: true
         }
      )
      

      With the error:

      MongoServerError: Plan executor error during findAndModify :: caused by :: Shard key update is not allowed without specifying the full shard key in the query
      

            Assignee:
            wenqin.ye@mongodb.com Wenqin Ye
            Reporter:
            wenqin.ye@mongodb.com Wenqin Ye
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: