$sort update modifier errors on a dollar-prefixed field during query shape computation

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Query Integration
    • Fully Compatible
    • ALL
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      The $push update operator with $sort on dollar-prefixed field errors out while computing query stats store key

      Minimal repro:

      MongoDB Enterprise > db.coll.update({_id: 1}, {"$push": {"array": {"$each": [], "$sort": {"$": 1}}}})
      WriteResult({
       "nMatched" : 0,
       "nUpserted" : 0,
       "nModified" : 0,
       "writeErrors" : {
       "code" : 435,
       "errmsg" : "Failed to create query stats store key"
       }
      })

      mongod log:

      {"t":{"$date":"2025-12-19T01:35:45.969+00:00"},"s":"W",  "c":"QUERY",    "id":8472507, "ctx":"conn1","msg":"Failed to compute query shape","attr":{"command":"{ update: \"coll\", bypassDocumentValidation: false, ordered: true, updates: [ { q: { _id: 1.0 }, u: { $push: { array: { $each: [], $sort: { $: 1.0 } } } }, multi: false, upsert: false } ], lsid: { id: UUID(\"5e59758b-38c9-4032-97c8-a9d9fa5ffc29\") } }","error":"Location16410: Consider using $getField or $setField for a field path with '.' or '$'. :: caused by :: FieldPath field names may not start with '$', given '$'."}}

       

            Assignee:
            Anna Veselova
            Reporter:
            Anna Veselova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: