Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-11271

Index field in dropIndex command can be a document containing the keys in the index

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Do
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • Server
    • None

    Description

      This works back to 2.6:

      MongoDB Enterprise > db.runCommand({createIndexes : "java2757", indexes : [{key : {score : 1}, name : "myScoreIdx" }] })
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      MongoDB Enterprise > db.runCommand({dropIndexes: "java2757", index : {score : 1}} )
      { "nIndexesWas" : 2, "ok" : 1 }
      

      It's not clear from the documentation that index can be anything other than the index name or "*".

      Attachments

        Activity

          People

            Unassigned Unassigned
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              1 year, 14 weeks, 2 days ago