• Type: Icon: Story Story
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 5
    • Needed
    • Hide

      See animated GIF here: https://github.com/mongodb-js/vscode/pull/161.

      Essentially, we added a button to create a playground with a template to create an index.

      Show
      See animated GIF here: https://github.com/mongodb-js/vscode/pull/161 . Essentially, we added a button to create a playground with a template to create an index.
    • Iteration Jackfruit, Iteration Kiwi

      User Story

      As a user,
      I want a quick way to create indexes for a collection,
      So that I can easily add an index when I feel it's missing without manually creating a playground and having to remember the right command.

      Acceptance criteria

      • Next to Indexes, we show an entry point to create an index with a playground
      • When I click on the entry point, we open a new playground file with a template for index creation and pointers to the documentation
      • Field autocomplete works for creating index method

      Telemetry (tracking plan)

      • Added Treeview Action Clicked with action=createIndex event to tracking plan

      Playground template

      // MongoDB Playground
      // Use Ctrl+Space inside a snippet or a string literal to trigger completions.
      
      // The current database to use.
      use('CURRENT_DATABASE');
      
      // Search for documents in the current collection.
      db.getCollection('CURRENT_COLLECTION')
        .createIndex(
          {
            /*
             * Keys
             * 
             * Normal index 
             * fieldA:  1, //ascending
             * fieldB: -1  //descending
             * 
             * Wildcard index
             * '$**': 1, //wildcard index on all fields and subfields in a document
             * 'path.to.field.$**': 1 //wildcard index on a specific field and its subpaths
             * 
             * Text index
             * fieldA: 'text',
             * fieldB: 'text'
             * 
             * Geospatial Index
             * locationField: '2dsphere'
             * 
             * Hashed Index
             * fieldA: 'hashed'
             */
          },
          {
            /*
             * Options (https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/#options-for-all-index-types)
             *
             * background: true, //ignored in 4.2+
             * unique: false,
             * name: 'some name',
             * partialFilterExpression: {},
             * sparse: false,
             * expireAfterSeconds: TTL,
             * collation: {}
             */
          }
        );
      

            Assignee:
            rhys.howell@mongodb.com Rhys Howell
            Reporter:
            massimiliano.marcon@mongodb.com Massimiliano Marcon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: