Introduction to MongoDB
1.0 - draft
1.0 - draft
  • MongoDB
  • Getting Started
    • General
      • Database? Collection? Schema?
      • RDBMS? NoSQL?
      • Scale-Up ? Scale - out?
      • JavaScript Object Notation
    • MongoDB
      • 간략한 역사,
    • Manipulating Database
      • MongoShell
      • PyMongo
  • CRUD
    • General
      • Explain()
      • mongoimport
    • Create
      • Mongo Shell
      • PyMongo
      • Exercises
    • Read
      • Mongo Shell
      • PyMongo
      • Exercises
    • Update
      • Mongo Shell
      • PyMongo
      • Exercises
    • Delete
      • PyMongo
      • Exercises
    • Challenging Exercises
      • Exercise 1
  • Index with Geospatial & Text
    • Basic Index
      • Syntax
      • Exercises
    • Geospatial Index
      • Syntax
      • Exercises
    • Text Index
      • Syntax
      • Exercises
    • Challenge
  • Aggregate framework
    • Aggregate Framework
      • Basic
      • Exercises
  • Distributed
    • Replication
      • Setup
        • Configuration File
        • Running Servers
        • Initiation
        • Exercises
      • Concerns
        • Read Concern
        • Write Concern
        • Exercises
    • Sharding
      • Getting Started
      • Setup
  • MongoDB 4.0 Features
    • Multi-Document Transaction
      • Transaction?
      • Basic
      • Exercises
  • Administration
    • Untitled
Powered by GitBook
On this page

Was this helpful?

  1. Index with Geospatial & Text
  2. Geospatial Index

Syntax

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

pymongo.GEO2D: 2d

pymongo.GEOSPHERE: 2dsphere

  • Syntax

    collection.create_index( [ (‘field’, TYPE) ] )	# Create Index
    collection.index_information()		# Get Index Info
    collection.drop_index( [ (‘field’, TYPE) ] )	# Drop Index
  • Example for geospatial index

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

PreviousGeospatial IndexNextExercises

Last updated 5 years ago

Was this helpful?