Skip to content

PYTHON-2860 Remove modifiers option from command monitoring spec test #701

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pymongo/cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ def __init__(self, collection, filter=None, projection=None, skip=0,
sort=None, allow_partial_results=False, oplog_replay=False,
modifiers=None, batch_size=0, manipulate=True,
collation=None, hint=None, max_scan=None, max_time_ms=None,
max=None, min=None, return_key=False, show_record_id=False,
snapshot=False, comment=None, session=None,
max=None, min=None, return_key=None, show_record_id=None,
snapshot=None, comment=None, session=None,
allow_disk_use=None):
"""Create a new cursor.

Expand Down Expand Up @@ -391,12 +391,12 @@ def __query_spec(self):
operators["$max"] = self.__max
if self.__min:
operators["$min"] = self.__min
if self.__return_key:
if self.__return_key is not None:
operators["$returnKey"] = self.__return_key
if self.__show_record_id:
if self.__show_record_id is not None:
# This is upgraded to showRecordId for MongoDB 3.2+ "find" command.
operators["$showDiskLoc"] = self.__show_record_id
if self.__snapshot:
if self.__snapshot is not None:
operators["$snapshot"] = self.__snapshot

if operators:
Expand Down
28 changes: 13 additions & 15 deletions test/command_monitoring/legacy/find.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,19 @@
"skip": {
"$numberLong": "2"
},
"modifiers": {
"$comment": "test",
"$hint": {
"_id": 1
},
"$max": {
"_id": 6
},
"$maxTimeMS": 6000,
"$min": {
"_id": 0
},
"$returnKey": false,
"$showDiskLoc": false
}
"comment": "test",
"hint": {
"_id": 1
},
"max": {
"_id": 6
},
"maxTimeMS": 6000,
"min": {
"_id": 0
},
"returnKey": false,
"showRecordId": false
}
},
"expectations": [
Expand Down
2 changes: 2 additions & 0 deletions test/test_command_monitoring_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def run_scenario(self):
elif name == 'find':
if 'sort' in args:
args['sort'] = list(args['sort'].items())
if 'hint' in args:
args['hint'] = list(args['hint'].items())
for arg in 'skip', 'limit':
if arg in args:
args[arg] = int(args[arg])
Expand Down