Show playground results in the documents data browsing view

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Developer Tools

      Playground results aren’t always cursors or documents returned from the database. We account for that and still have the current way of showing results (without the explicit document handling capabilities like the edit document code lens). In those cases, like if a string is returned, let's keep the existing editor view of the output. It's lighter weight than starting up the webview, and we don't need the functionality of the data browser.

      We provide the ability for folks to edit the documents that are returned in playground results when the result is from a collection and the documents have _ids.

      Code lens that provides the action:

      https://github.com/mongodb-js/vscode/blob/72619c7a6572c2eb73de61f146e8679559850c0f/src/editors/editDocumentCodeLensProvider.ts#L92 

      Playground results: https://github.com/mongodb-js/vscode/blob/72619c7a6572c2eb73de61f146e8679559850c0f/src/language/languageServerController.ts#L180 

      Rendered: https://github.com/mongodb-js/vscode/blob/72619c7a6572c2eb73de61f146e8679559850c0f/src/editors/playgroundResultProvider.ts#L67 

      We maintain this behavior in the new view, we’ll flag documents as editable when they’re passed to the webview. 

      There is a limitation here, which already exists, in that if the user projects or changes the _id value of the documents returned, we could end up editing an unintended document. This is something we allow as the user will still open the document when editing which will show them the current state of the document. For instance:

      db.collection.aggregate([  

        {  

          $project:

      {         _id: "$name"     }

        

        }  

      ]);

       

      We don’t show the + add document when showing playground results, or the `Refresh` button.

            Assignee:
            Unassigned
            Reporter:
            Rhys Howell
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: