26
26
.. versionadded:: 1.5.1
28
.. note:: Geo-spatial indexing requires server version **>= 1.3.3+**.
28
.. note:: Geo-spatial indexing requires server version **>= 1.3.3**.
30
.. _geospatial index: http://www.mongodb.org/display/DOCS/Geospatial+Indexing
30
.. _geospatial index: http://docs.mongodb.org/manual/core/geospatial-indexes/
33
33
GEOHAYSTACK = "geoHaystack"
36
36
.. versionadded:: 2.1
38
.. note:: Geo-spatial indexing requires server version **>= 1.5.6+**.
38
.. note:: Geo-spatial indexing requires server version **>= 1.5.6**.
40
.. _geospatial index: http://www.mongodb.org/display/DOCS/Geospatial+Haystack+Indexing
40
.. _haystack index: http://docs.mongodb.org/manual/core/geospatial-indexes/#haystack-indexes
45
44
"""No database profiling."""
49
48
"""Profile all operations."""
52
"""An enum that defines the read preferences supported by PyMongo.
54
+----------------------+--------------------------------------------------+
55
| Connection type | Read Preference |
56
+======================+================+================+================+
57
| |`PRIMARY` |`SECONDARY` |`SECONDARY_ONLY`|
58
+----------------------+----------------+----------------+----------------+
59
|Connection to a single|Queries are |Queries are |Same as |
60
|host. |allowed if the |allowed if the |`SECONDARY` |
61
| |connection is to|connection is to| |
62
| |the replica set |the replica set | |
63
| |primary. |primary or a | |
65
+----------------------+----------------+----------------+----------------+
66
|Connection to a |Queries are sent|Queries are |Same as |
67
|mongos. |to the primary |distributed |`SECONDARY` |
68
| |of a shard. |among shard | |
70
| | |Queries are sent| |
71
| | |to the primary | |
73
| | |secondaries are | |
76
+----------------------+----------------+----------------+----------------+
77
|ReplicaSetConnection |Queries are sent|Queries are |Queries are |
78
| |to the primary |distributed |never sent to |
79
| |of the replica |among replica |the replica set |
80
| |set. |set secondaries.|primary. An |
81
| | |Queries are sent|exception is |
82
| | |to the primary |raised if no |
83
| | |if no |secondary is |
84
| | |secondaries are |available. |
87
+----------------------+----------------+----------------+----------------+
94
version_tuple = (2, 2)
50
version_tuple = (2, 4, 2)
96
52
def get_version_string():
97
53
if isinstance(version_tuple[-1], basestring):
102
58
"""Current version of PyMongo."""
104
60
from pymongo.connection import Connection
61
from pymongo.mongo_client import MongoClient
62
from pymongo.mongo_replica_set_client import MongoReplicaSetClient
105
63
from pymongo.replica_set_connection import ReplicaSetConnection
64
from pymongo.read_preferences import ReadPreference
108
67
"""Is the C extension installed?