Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created September 9, 2020 14:12
Show Gist options
  • Save aniruddha27/a1fe8a4cad733816da7d5dda7cf1c53b to your computer and use it in GitHub Desktop.
Save aniruddha27/a1fe8a4cad733816da7d5dda7cf1c53b to your computer and use it in GitHub Desktop.
# Drop previous indexes
db.restaurants.drop_indexes()
# Create Geospatial index
db.restaurants.create_index([('address.coord', pymongo.GEO2D)],
name='coord')
# 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