diff --git a/bson/binary.py b/bson/binary.py index 20de093ce..34be83e90 100644 --- a/bson/binary.py +++ b/bson/binary.py @@ -136,26 +136,28 @@ class UUIDLegacy(Binary): .. doctest:: >>> import uuid - >>> from bson.binary import Binary, UUIDLegacy + >>> from bson.binary import Binary, UUIDLegacy, UUID_SUBTYPE >>> my_uuid = uuid.uuid4() - >>> db.test.insert({'uuid': Binary(my_uuid.bytes, 3)}) + >>> coll = db.test + >>> coll.uuid_subtype = UUID_SUBTYPE + >>> coll.insert({'uuid': Binary(my_uuid.bytes, 3)}) ObjectId('...') - >>> db.test.find({'uuid': my_uuid}).count() + >>> coll.find({'uuid': my_uuid}).count() 0 - >>> db.test.find({'uuid': UUIDLegacy(my_uuid)}).count() + >>> coll.find({'uuid': UUIDLegacy(my_uuid)}).count() 1 - >>> db.test.find({'uuid': UUIDLegacy(my_uuid)})[0]['uuid'] + >>> coll.find({'uuid': UUIDLegacy(my_uuid)})[0]['uuid'] UUID('...') >>> >>> # Convert from subtype 3 to subtype 4 - >>> doc = db.test.find_one({'uuid': UUIDLegacy(my_uuid)}) - >>> db.test.save(doc) + >>> doc = coll.find_one({'uuid': UUIDLegacy(my_uuid)}) + >>> coll.save(doc) ObjectId('...') - >>> db.test.find({'uuid': UUIDLegacy(my_uuid)}).count() + >>> coll.find({'uuid': UUIDLegacy(my_uuid)}).count() 0 - >>> db.test.find({'uuid': {'$in': [UUIDLegacy(my_uuid), my_uuid]}}).count() + >>> coll.find({'uuid': {'$in': [UUIDLegacy(my_uuid), my_uuid]}}).count() 1 - >>> db.test.find_one({'uuid': my_uuid})['uuid'] + >>> coll.find_one({'uuid': my_uuid})['uuid'] UUID('...') Raises TypeError if `obj` is not an instance of :class:`~uuid.UUID`. diff --git a/doc/examples/geo.rst b/doc/examples/geo.rst index 3c7639a1d..6f766c6d9 100644 --- a/doc/examples/geo.rst +++ b/doc/examples/geo.rst @@ -78,8 +78,8 @@ Or circle (specified by center point and radius): ... repr(doc) ... "{u'loc': [1, 2], u'_id': ObjectId('...')}" - "{u'loc': [2, 5], u'_id': ObjectId('...')}" "{u'loc': [4, 4], u'_id': ObjectId('...')}" + "{u'loc': [2, 5], u'_id': ObjectId('...')}" geoNear queries are also supported using :class:`~bson.son.SON`: diff --git a/doc/examples/map_reduce.rst b/doc/examples/map_reduce.rst index ec59b995d..b4347e5c9 100644 --- a/doc/examples/map_reduce.rst +++ b/doc/examples/map_reduce.rst @@ -114,6 +114,6 @@ With MongoDB 1.8.0 or newer you can use :class:`~bson.son.SON` to specify a diff >>> from bson.son import SON >>> db.things.map_reduce(mapper, reducer, out=SON([("replace", "results"), ("db", "outdb")]), full_response=True) - {u'counts': {u'input': 4, u'reducer': 2, u'emit': 6, u'output': 3}, u'timeMillis': ..., u'ok': ..., u'result': {u'db': ..., u'collection': ...}} + {u'counts': {u'input': 4, u'reduce': 2, u'emit': 6, u'output': 3}, u'timeMillis': ..., u'ok': ..., u'result': {u'db': ..., u'collection': ...}} .. seealso:: The full list of options for MongoDB's `map reduce engine `_ diff --git a/pymongo/replica_set_connection.py b/pymongo/replica_set_connection.py index 3878dea65..750745b41 100644 --- a/pymongo/replica_set_connection.py +++ b/pymongo/replica_set_connection.py @@ -24,7 +24,7 @@ attribute-style access: .. doctest:: >>> from pymongo import ReplicaSetConnection - >>> c = ReplicaSetConnection('localhost:31017', replicaSet='repl0') + >>> c = ReplicaSetConnection('localhost:27017', replicaSet='repl0') >>> c.test_database Database(ReplicaSetConnection([u'...', u'...']), u'test_database') >>> c['test_database']