Skip to content

Commit 74eb28c

Browse files
committed
Migration guide updates
1 parent bbff9ff commit 74eb28c

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

doc/migrate-to-pymongo3.rst

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ Warnings can also be changed to errors::
3737

3838
python -Wd -Werror <your application>
3939

40+
.. note:: Not all deprecated features raise :exc:`DeprecationWarning` when
41+
used. For example, the :meth:`~pymongo.collection.Collection.find` options
42+
renamed in PyMongo 3.0 do not raise :exc:`DeprecationWarning` when used in
43+
PyMongo 2.x. See also `Removed features with no migration path`_.
44+
4045
CRUD API
4146
--------
4247

@@ -241,10 +246,24 @@ can be changed to this with PyMongo 2.9 or later:
241246

242247
.. seealso:: :meth:`~pymongo.database.Database.get_collection`
243248

244-
The "tag_sets" attribute is removed
245-
...................................
249+
The "tag_sets" option and attribute are removed
250+
...............................................
246251

247-
Code like this::
252+
The `tag_sets` MongoClient option is removed. The `read_preference`
253+
option can be used instead. Code like this::
254+
255+
>>> client = MongoClient(
256+
... read_preference=ReadPreference.SECONDARY,
257+
... tag_sets=[{"dc": "ny"}, {"dc": "sf"}])
258+
259+
can be changed to this with PyMongo 2.9 or later:
260+
261+
.. doctest::
262+
263+
>>> from pymongo.read_preferences import Secondary
264+
>>> client = MongoClient(read_preference=Secondary([{"dc": "ny"}]))
265+
266+
To change the tags sets for a Database or Collection, code like this::
248267

249268
>>> db = client.my_database
250269
>>> db.read_preference = ReadPreference.SECONDARY
@@ -254,7 +273,6 @@ can be changed to this with PyMongo 2.9 or later:
254273

255274
.. doctest::
256275

257-
>>> from pymongo.read_preferences import Secondary
258276
>>> db = client.get_database("my_database",
259277
... read_preference=Secondary([{"dc": "ny"}]))
260278

@@ -506,8 +524,8 @@ can be replaced by this in PyMongo 2.9 or later:
506524
>>> from bson.son import SON
507525
>>> encoded = BSON.encode({"a": 1}, codec_options=CodecOptions(SON))
508526

509-
Advice for features removed in PyMongo 3
510-
----------------------------------------
527+
Removed features with no migration path
528+
---------------------------------------
511529

512530
MasterSlaveConnection is removed
513531
................................

0 commit comments

Comments
 (0)