Uploaded image for project: 'VS Code Extension'
  1. VS Code Extension
  2. VSCODE-466

print and printjson not behaving the same in playgrounds as mongosh

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • 3
    • Not Needed
    • Iteration Juravenator

      Problem Statement/Rationale

      More context can be found: https://mongodb.slack.com/archives/CUHC9R8J0/p1693414162868599

      When I run this code block:

      use('guitarStore');
      const res = db.reviews.find({});
      print(res);

       

      Mongosh outputs the result json as such:

       

       Atlas atlas-he6ppn-shard-0 [primary] guitarStore> print(res);
      [
        {
          _id: ObjectId("64c84039b652adf3fe1caae5"),
          reviewer_name: 'Alex',
          rating: 3,
          review_message: 'I have been playing guitar for years and I have to say, I am thoroughly impressed with this electric guitar. It easily competes with some of the higher-end models on the market. The sound, the feel, and the quality are all top-notch.'
        }]
      

       

      However, VS Code playground outputs:

      [object Object]

       

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

      Steps to Reproduce

      Run a similar block to above example in both playgrounds and shell

      Expected Results

      Output from playground should align with the shell

       

       

            Assignee:
            rhys.howell@mongodb.com Rhys Howell
            Reporter:
            gaurab.aryal@mongodb.com Gaurab Aryal
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: