Skip to content

Commit ce60119

Browse files
committed
PYTHON-2097 Deprecate oplogReplay find command option
1 parent 2157dc5 commit ce60119

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

doc/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Changes in Version 3.11.0
66

77
Version 3.11 adds support for MongoDB 4.4. Highlights include:
88

9+
- Deprecated the ``oplog_replay`` parameter to
10+
:meth:`pymongo.collection.Collection.find`. Starting in MongoDB 4.4, the
11+
server optimizes queries against the oplog collection without requiring
12+
the user to set this flag.
913
- Added index hinting support to the
1014
:meth:`pymongo.collection.Collection.replace_one`,
1115
:meth:`pymongo.collection.Collection.update_one`,

doc/examples/tailable.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ of a replica set member::
2424
while True:
2525
# For a regular capped collection CursorType.TAILABLE_AWAIT is the
2626
# only option required to create a tailable cursor. When querying the
27-
# oplog the oplog_replay option enables an optimization to quickly
27+
# oplog, the oplog_replay option enables an optimization to quickly
2828
# find the 'ts' value we're looking for. The oplog_replay option
29-
# can only be used when querying the oplog.
29+
# can only be used when querying the oplog. Starting in MongoDB 4.4
30+
# this option is ignored by the server as queries against the oplog
31+
# are optimized automatically by the MongoDB query engine.
3032
cursor = oplog.find({'ts': {'$gt': ts}},
3133
cursor_type=pymongo.CursorType.TAILABLE_AWAIT,
3234
oplog_replay=True)

pymongo/collection.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,12 +1366,12 @@ def find(self, *args, **kwargs):
13661366
- `allow_partial_results` (optional): if True, mongos will return
13671367
partial results if some shards are down instead of returning an
13681368
error.
1369-
- `oplog_replay` (optional): If True, set the oplogReplay query
1370-
flag.
1369+
- `oplog_replay` (optional): **DEPRECATED** - if True, set the
1370+
oplogReplay query flag. Default: False.
13711371
- `batch_size` (optional): Limits the number of documents returned in
13721372
a single batch.
1373-
- `manipulate` (optional): **DEPRECATED** - If True (the default),
1374-
apply any outgoing SON manipulators before returning.
1373+
- `manipulate` (optional): **DEPRECATED** - If True, apply any
1374+
outgoing SON manipulators before returning. Default: True.
13751375
- `collation` (optional): An instance of
13761376
:class:`~pymongo.collation.Collation`. This option is only supported
13771377
on MongoDB 3.4 and above.
@@ -1436,6 +1436,10 @@ def find(self, *args, **kwargs):
14361436
14371437
.. versionchanged:: 3.11
14381438
Added the ``allow_disk_use`` option.
1439+
Deprecated the ``oplog_replay`` option. Support for this option is
1440+
deprecated in MongoDB 4.4. The query engine now automatically
1441+
optimizes queries against the oplog without requiring this
1442+
option to be set.
14391443
14401444
.. versionchanged:: 3.7
14411445
Deprecated the ``snapshot`` option, which is deprecated in MongoDB

0 commit comments

Comments
 (0)