> For the complete documentation index, see [llms.txt](https://koonkim.gitbook.io/mongodb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://koonkim.gitbook.io/mongodb/master/index/advanced-index-in-pymongo/syntax.md).

# Syntax

{% hint style="info" %}
기본 인덱싱을 하는 것과 마찬가지로 2d와 2dsphere 또한 미리 선언되어 쉽게 이해하도록 제공해 준다.

pymongo.GEO2D: 2d

pymongo.GEOSPHERE:  2dsphere
{% endhint %}

* Syntax

  ```python
  collection.create_index( [ (‘field’, TYPE) ] )	# Create Index
  collection.index_information()		# Get Index Info
  collection.drop_index( [ (‘field’, TYPE) ] )	# Drop Index
  ```
* &#x20;Example for geospatial index

  ```python
  from pymongo import MongoClient, GEOSPHERE
  client = MongoClient()
  db = client.geo
  col = db.states
  col.create_index([("loc", GEOSPHERE)])
  ```

###

##
