Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-7132

Updating document string value to "[object Object]" turns into empty string

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.39.4
    • Affects Version/s: 1.39.1, 1.39.2
    • Component/s: None
    • None
    • Environment:
      OS: Windows 10
      node.js / npm versions:
      Additional info: Compass 1.39.1
    • Not Needed

      Problem Statement/Rationale

       When I type a string literal into the document update box, I expect that the string will accept any valid Unicode input. However, typing "[object Object]" will reset the field to an empty string when the closing brace is typed.

      Prior  to typing the closing brace, this is what the text looks like.

      After typing the final closing brace, the string becomes empty. I can do this again by typing "[object Object]" again, even without closing the edit document window or without restarting the application. When update is clicked, the empty string is saved to the document.

      Other similar strings do not have this behavior. Examples are "[]", "[foobar]", and "[object Objects]".

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

      After checking the logs, I don't see anything relevant, since the actions taken involve keypresses without sending the update. Please contact me if you have trouble reproducing.

      Steps to Reproduce

      1. Open a collection with at least one document with a string field.
      2. Double click on the string value to enter "Edit Document" mode.
      3. Type "[object Object]" (no quotes) into the field.

      Expected Results

      The new pending field value is "[object Object]".

      Actual Results

      The new pending field value is "".

      Additional Notes

      While this is an odd document modification, it is something I was required to do to test a script to fix broken data. I am unaware if there are any other magic strings that cause similar problems.

        1. image-2023-08-21-11-41-43-993.png
          31 kB
          Eric Dilmore
        2. image-2023-08-21-11-42-11-940.png
          29 kB
          Eric Dilmore
        3. image-2023-08-21-11-45-15-544.png
          31 kB
          Eric Dilmore

            Assignee:
            maurizio.casimirri@mongodb.com Maurizio Casimirri
            Reporter:
            eric.dilmore@oakstreethealth.com Eric Dilmore
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: