From 06965062d91274104719ef3c8e6063d87d521e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Puente=20Sarr=C3=ADn?= Date: Sat, 20 Apr 2013 23:41:08 -0500 Subject: [PATCH 1/3] Prefer to use MongoClient instead of Connection class in PyMongo --- source/use-cases/product-catalog.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/use-cases/product-catalog.txt b/source/use-cases/product-catalog.txt index d4d8f5b4bcd..591fa71d239 100644 --- a/source/use-cases/product-catalog.txt +++ b/source/use-cases/product-catalog.txt @@ -526,22 +526,22 @@ per-connection or per-operation basis. In :api:`PyMongo ` argument. The -:py:attr:`SECONDARY ` +:py:attr:`SECONDARY ` property in the following example, permits reads from a :term:`secondary` (as well as a primary) for the entire connection . .. code-block:: python - conn = pymongo.Connection(read_preference=pymongo.SECONDARY) + conn = pymongo.MongoClient(read_preference=pymongo.SECONDARY) Conversely, the -:py:attr:`SECONDARY_ONLY ` +:py:attr:`SECONDARY_ONLY ` read preference means that the client will only send read operation only to the secondary member .. code-block:: python - conn = pymongo.Connection(read_preference=pymongo.SECONDARY_ONLY) + conn = pymongo.MongoClient(read_preference=pymongo.SECONDARY_ONLY) You can also specify :py:attr:`read_preference ` From fa97ddb6458800b89fdbb02c6b1f3d1d8f4febed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Puente=20Sarr=C3=ADn?= Date: Sun, 21 Apr 2013 00:07:53 -0500 Subject: [PATCH 2/3] Refering to PyMongo's ReadPreference class --- source/use-cases/product-catalog.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/use-cases/product-catalog.txt b/source/use-cases/product-catalog.txt index 591fa71d239..7d56c60a9c8 100644 --- a/source/use-cases/product-catalog.txt +++ b/source/use-cases/product-catalog.txt @@ -544,9 +544,8 @@ client will only send read operation only to the secondary member conn = pymongo.MongoClient(read_preference=pymongo.SECONDARY_ONLY) You can also specify -:py:attr:`read_preference ` -for specific queries, -as follows: +:py:class:`read_preference ` +for specific queries, as follows: .. code-block:: python From cbba98c9b576234d642531197968dfbf061ef607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Puente=20Sarr=C3=ADn?= Date: Sun, 21 Apr 2013 00:13:22 -0500 Subject: [PATCH 3/3] MongoClient instead of Connection in PyMongo at a use case --- source/use-cases/storing-log-data.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/use-cases/storing-log-data.txt b/source/use-cases/storing-log-data.txt index 36cd1eecea9..534dff3ecee 100644 --- a/source/use-cases/storing-log-data.txt +++ b/source/use-cases/storing-log-data.txt @@ -195,7 +195,7 @@ using PyMongo, with an event from the Apache Log: >>> import bson >>> import pymongo >>> from datetime import datetime - >>> conn = pymongo.Connection() + >>> conn = pymongo.MongoClient() >>> db = conn.event_db >>> event = { ... _id: bson.ObjectId(),