db.collection.dropIndexes() errors out on MongoDB VS Code Extension

Hello,

I have the following indexes in people collection: (as a result of db.people.getIndexes()):

[
  {
    "v": 2,
    "key": {
      "_id": 1
    },
    "name": "_id_"
  },
  {
    "v": 2,
    "key": {
      "last_name": 1,
      "address.state": 1
    },
    "name": "last_name_1_address.state_1"
  },
  {
    "v": 2,
    "key": {
      "birthday": 1
    },
    "name": "birthday_1"
  }
]

I want to drop all indexes. Running the command from MongoDB VS Code Extension gives Missing required argument error:
db.people.getIndexes()

However, checking the documentation, it states that the parameter is optional, and omitting it will drop all indexes except for that of _id.

@Omer_Toraman1

The playground environment in which you are running that command, isn’t quite the same as running the command in the shell. It isn’t as fully featured yet.

So for now, right click on the database connection you are using with VSC, and “Launch a MongoDB Shell”, for that bit of admin.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.