- 
    Type:
Story
 - 
    Resolution: Fixed
 - 
    Priority:
Major - P3
 - 
    Affects Version/s: None
 - 
    Component/s: None
 - 
    None
 
- 
        5
 - 
        Iteration Jackfruit, Iteration Kiwi
 
- 
        Needed
 - 
        
 
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: {} */ } );