Skip to content

Commit 24cc4c4

Browse files
authored
PYTHON-3019 Fix doc test failures (#794)
Remove pymongo 2 to 3 migration guide. Make raw_bson doc tests less flakey.
1 parent e655b0b commit 24cc4c4

File tree

5 files changed

+13
-558
lines changed

5 files changed

+13
-558
lines changed

bson/raw_bson.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@
2828
>>> client.drop_database('db')
2929
>>> client.drop_database('replica_db')
3030
>>> db = client.db
31-
>>> result = db.test.insert_many([{'a': 1},
32-
... {'b': 1},
33-
... {'c': 1},
34-
... {'d': 1}])
31+
>>> result = db.test.insert_many([{'_id': 1, 'a': 1},
32+
... {'_id': 2, 'b': 1},
33+
... {'_id': 3, 'c': 1},
34+
... {'_id': 4, 'd': 1}])
3535
>>> replica_db = client.replica_db
3636
>>> for doc in db.test.find():
3737
... print(f"raw document: {doc.raw}")
3838
... print(f"decoded document: {bson.decode(doc.raw)}")
3939
... result = replica_db.test.insert_one(doc)
4040
raw document: b'...'
41-
decoded document: {'_id': ObjectId('...'), 'a': 1}
41+
decoded document: {'_id': 1, 'a': 1}
4242
raw document: b'...'
43-
decoded document: {'_id': ObjectId('...'), 'b': 1}
43+
decoded document: {'_id': 2, 'b': 1}
4444
raw document: b'...'
45-
decoded document: {'_id': ObjectId('...'), 'c': 1}
45+
decoded document: {'_id': 3, 'c': 1}
4646
raw document: b'...'
47-
decoded document: {'_id': ObjectId('...'), 'd': 1}
47+
decoded document: {'_id': 4, 'd': 1}
4848
4949
For use cases like moving documents across different databases or writing binary
5050
blobs to disk, using raw BSON documents provides better speed and avoids the

doc/changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1881,7 +1881,9 @@ Changes in Version 2.9
18811881
Version 2.9 provides an upgrade path to PyMongo 3.x. Most of the API changes
18821882
from PyMongo 3.0 have been backported in a backward compatible way, allowing
18831883
applications to be written against PyMongo >= 2.9, rather then PyMongo 2.x or
1884-
PyMongo 3.x. See the :doc:`/migrate-to-pymongo3` for detailed examples.
1884+
PyMongo 3.x. See the `PyMongo 3 Migration Guide
1885+
<https://pymongo.readthedocs.io/en/3.12.1/migrate-to-pymongo3.html>`_ for
1886+
detailed examples.
18851887

18861888
.. note:: There are a number of new deprecations in this release for features
18871889
that were removed in PyMongo 3.0.

doc/index.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ everything you need to know to use **PyMongo**.
3434
:doc:`migrate-to-pymongo4`
3535
A PyMongo 3.x to 4.x migration guide.
3636

37-
:doc:`migrate-to-pymongo3`
38-
A PyMongo 2.x to 3.x migration guide.
39-
4037
:doc:`python3`
4138
Frequently asked questions about python 3 support.
4239

@@ -123,5 +120,4 @@ Indices and tables
123120
changelog
124121
python3
125122
migrate-to-pymongo4
126-
migrate-to-pymongo3
127123
developer/index

0 commit comments

Comments
 (0)