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

Fields are reordered alphabetically by key when editing an existing document

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 6.0.5
    • Component/s: None
    • Environment:
      OS: Windows 10
      node.js / npm versions: latest stable
      Additional info:
    • Server Triage
    • ALL

      Problem Statement/Rationale

      When updating an existing document in Atlas, the fields are reordered in alphabetical order by key, rather than maintaining the order they were entered in upon applying the update.

      Please be sure to attach relevant logs with any sensitive data redacted.
      How to retrieve logs for: Compass; Shell

      Steps to Reproduce

      1. Insert a new document in a collection in Atlas containing only the auto-generated ObjectID field/value pair
      2. Edit the document you just created, adding one field with a key that starts with "Z" and a second field with a key that starts with "A"
      3. Click Update. 

      Expected Results

      The fields should retain the order from the update interface. The Z field should come first, and the A field should come second.

      Actual Results

      The keys and values are both saved, but they're reordered so the A key is first, and the Z key is second

      Additional Notes

      This appears to be related/similar to SERVER-2592. I've also seen the same behavior in Compass, but I don't have screenshots from Compass currently. I'm using a M0 Sandbox (General) tier cluster.

        1. image-2023-04-30-19-19-23-858.png
          image-2023-04-30-19-19-23-858.png
          19 kB
        2. image-2023-04-30-19-21-05-868.png
          image-2023-04-30-19-21-05-868.png
          18 kB
        3. image-2023-04-30-19-22-25-976.png
          image-2023-04-30-19-22-25-976.png
          9 kB

            Assignee:
            backlog-server-triage [HELP ONLY] Backlog - Triage Team
            Reporter:
            mdfisher4@wisc.edu Michelle Fisher
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: