From 734986c1b59ac4a8ee6af4821db32fa891fa58a1 Mon Sep 17 00:00:00 2001 From: Robert Kajic Date: Thu, 16 Feb 2012 10:41:47 +0100 Subject: [PATCH] Documentation on geospatial indexes and how to create them explicitly --- docs/guide/defining-documents.rst | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/guide/defining-documents.rst b/docs/guide/defining-documents.rst index fd005e40..004f7d8f 100644 --- a/docs/guide/defining-documents.rst +++ b/docs/guide/defining-documents.rst @@ -382,10 +382,25 @@ If a dictionary is passed then the following options are available: :attr:`unique` (Default: False) Whether the index should be sparse. -.. note:: - Geospatial indexes will be automatically created for all - :class:`~mongoengine.GeoPointField`\ s +Geospatial indexes +--------------------------- +Geospatial indexes will be automatically created for all +:class:`~mongoengine.GeoPointField`\ s + +It is also possible to explicitly define geospatial indexes. This is +useful if you need to define a geospatial index on a subfield of a +:class:`~mongoengine.DictField` or a custom field that contains a +point. To create a geospatial index you must prefix the field with the +***** sign. :: + + class Place(Document): + location = DictField() + meta = { + 'indexes': [ + '*location.point', + ], + } Ordering ========