Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created September 9, 2020 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha27/1bb60c856e4698e1b449ebc8c8548485 to your computer and use it in GitHub Desktop.
Save aniruddha27/1bb60c856e4698e1b449ebc8c8548485 to your computer and use it in GitHub Desktop.
# Drop previous indexes
db.restaurants.drop_indexes()
# Create Partial index
db.restaurants.create_index('cuisine',
partialFilterExpression={'grades.score':{'$gt':5}},
name='cuisine_score')
# List indexes
pprint(db.restaurants.index_information())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment