Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-1691

NO_COLOR is not fully honored by Mongosh

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.3
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      OS: Debian 11, Arm64 version.
      node.js / npm versions: 6.3.0
      Additional info:
      Running from bash 5.1.4
      Running from Mongosh 2.1.1
      Using an Ubuntu (bionic) version of Mongo.
      Had this same issue on Amazon Linux.
    • Developer Tools
    • 2
    • Not Needed

      Problem Statement/Rationale

      When I set the environment variable NO_COLOR for Mongosh to 1, only some of the colorization is removed. Things such as deprecation messages, error messages or pretty much anything between quotes remains colorized.

      This could potentially pose a problem for accessibility, as some users (such as those who are colorblind), might struggle to read with certain combinations of text and backgrounds. 

      Is there any chance you guys can make Mongosh truely mono colored? 

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

      {"t":{"$date":"2024-01-22T15:16:48.903+00:00"},"s":"I""c":"NETWORK""id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:47372","uuid":"46d1abd9-6ce1-4d48-9664-2805756152fd","connectionId":6,"connectionCount":1}}
      {"t":{"$date":"2024-01-22T15:16:48.973+00:00"},"s":"I""c":"NETWORK""id":51800,   "ctx":"conn6","msg":"client metadata","attr":{"remote":"127.0.0.1:47372","client":"conn6","doc":{"application":{"name":"mongosh 2.1.1"},"driver":{"name":"nodejs|mongosh","version":"6.3.0|2.1.1"},"platform":"Node.js v20.9.0, LE","os":{"name":"linux","architecture":"arm64","version":"5.10.0-27-cloud-arm64","type":"Linux"}}}}
      {"t":{"$date":"2024-01-22T15:16:49.002+00:00"},"s":"I""c":"NETWORK""id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:47378","uuid":"0d93cf7c-70a3-445e-bc76-d8d7ca866a65","connectionId":7,"connectionCount":2}}
      {"t":{"$date":"2024-01-22T15:16:49.003+00:00"},"s":"I""c":"NETWORK""id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:47382","uuid":"9afed25d-b9c3-42bd-8d9f-717a9b1272c3","connectionId":8,"connectionCount":3}}
      {"t":{"$date":"2024-01-22T15:16:49.010+00:00"},"s":"I""c":"NETWORK""id":51800,   "ctx":"conn7","msg":"client metadata","attr":{"remote":"127.0.0.1:47378","client":"conn7","doc":{"application":{"name":"mongosh 2.1.1"},"driver":{"name":"nodejs|mongosh","version":"6.3.0|2.1.1"},"platform":"Node.js v20.9.0, LE","os":{"name":"linux","architecture":"arm64","version":"5.10.0-27-cloud-arm64","type":"Linux"}}}}
      {"t":{"$date":"2024-01-22T15:16:49.011+00:00"},"s":"I""c":"NETWORK""id":51800,   "ctx":"conn8","msg":"client metadata","attr":{"remote":"127.0.0.1:47382","client":"conn8","doc":{"application":{"name":"mongosh 2.1.1"},"driver":{"name":"nodejs|mongosh","version":"6.3.0|2.1.1"},"platform":"Node.js v20.9.0, LE","os":{"name":"linux","architecture":"arm64","version":"5.10.0-27-cloud-arm64","type":"Linux"}}}}
      {"t":{"$date":"2024-01-22T15:16:49.020+00:00"},"s":"I""c":"NETWORK""id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:47392","uuid":"bf6bc1b1-16cc-4adb-bcad-69321c96e9e8","connectionId":9,"connectionCount":4}}
      {"t":{"$date":"2024-01-22T15:16:49.023+00:00"},"s":"I""c":"NETWORK""id":22943,   "ctx":"listener","msg":"Connection accepted","attr":{"remote":"127.0.0.1:47402","uuid":"fc13ff05-f66f-482a-9c7d-d9ff43279d0e","connectionId":10,"connectionCount":5}}
      {"t":{"$date":"2024-01-22T15:16:49.032+00:00"},"s":"I""c":"NETWORK""id":51800,   "ctx":"conn9","msg":"client metadata","attr":{"remote":"127.0.0.1:47392","client":"conn9","doc":{"application":{"name":"mongosh 2.1.1"},"driver":{"name":"nodejs|mongosh","version":"6.3.0|2.1.1"},"platform":"Node.js v20.9.0, LE","os":{"name":"linux","architecture":"arm64","version":"5.10.0-27-cloud-arm64","type":"Linux"}}}}
      {"t":{"$date":"2024-01-22T15:16:49.038+00:00"},"s":"I""c":"NETWORK""id":51800,   "ctx":"conn10","msg":"client metadata","attr":{"remote":"127.0.0.1:47402","client":"conn10","doc":{"application":{"name":"mongosh 2.1.1"},"driver":{"name":"nodejs|mongosh","version":"6.3.0|2.1.1"},"platform":"Node.js v20.9.0, LE","os":{"name":"linux","architecture":"arm64","version":"5.10.0-27-cloud-arm64","type":"Linux"}}}} 

      {}Steps to Reproduce

      NO_COLOR=1 mongosh 
      > db.test.insertOne( { x: 1 } );

      Expected Results

      For the output to all be in the same color as my terminal settings.

      Actual Results

      The true in the following is yellow and the inserted id is green:

      {
        acknowledged: true,
        insertedId: ObjectId('65ae880b1ae1776f7ab22738')
      } 

      Additional Notes

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            beth.granados@acumera.com Beth Granados
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: