Skip to content

Instantly share code, notes, and snippets.

@udhos
Created November 18, 2021 15:27
Show Gist options
  • Select an option

  • Save udhos/68cac4d31e9937432dcd9ab7efccc9ae to your computer and use it in GitHub Desktop.

Select an option

Save udhos/68cac4d31e9937432dcd9ab7efccc9ae to your computer and use it in GitHub Desktop.
mongodb_index.md
db.person.getIndexes()

db.person.createIndex( { "personId": 1 }, { unique: true } )

	Index already exists with different options

db.person.dropIndex("personId_1")

db.person.createIndex( { "personId": 1 }, { unique: true } )

	could not create unique index: person index: personId_1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment