Skip to content

Commit 22bbc1a

Browse files
authored
PYTHON-2860 Remove modifiers option from command monitoring spec test (#701)
1 parent 4fe2fad commit 22bbc1a

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

pymongo/cursor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ def __init__(self, collection, filter=None, projection=None, skip=0,
141141
sort=None, allow_partial_results=False, oplog_replay=False,
142142
modifiers=None, batch_size=0, manipulate=True,
143143
collation=None, hint=None, max_scan=None, max_time_ms=None,
144-
max=None, min=None, return_key=False, show_record_id=False,
145-
snapshot=False, comment=None, session=None,
144+
max=None, min=None, return_key=None, show_record_id=None,
145+
snapshot=None, comment=None, session=None,
146146
allow_disk_use=None):
147147
"""Create a new cursor.
148148
@@ -391,12 +391,12 @@ def __query_spec(self):
391391
operators["$max"] = self.__max
392392
if self.__min:
393393
operators["$min"] = self.__min
394-
if self.__return_key:
394+
if self.__return_key is not None:
395395
operators["$returnKey"] = self.__return_key
396-
if self.__show_record_id:
396+
if self.__show_record_id is not None:
397397
# This is upgraded to showRecordId for MongoDB 3.2+ "find" command.
398398
operators["$showDiskLoc"] = self.__show_record_id
399-
if self.__snapshot:
399+
if self.__snapshot is not None:
400400
operators["$snapshot"] = self.__snapshot
401401

402402
if operators:

test/command_monitoring/legacy/find.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,19 @@
8989
"skip": {
9090
"$numberLong": "2"
9191
},
92-
"modifiers": {
93-
"$comment": "test",
94-
"$hint": {
95-
"_id": 1
96-
},
97-
"$max": {
98-
"_id": 6
99-
},
100-
"$maxTimeMS": 6000,
101-
"$min": {
102-
"_id": 0
103-
},
104-
"$returnKey": false,
105-
"$showDiskLoc": false
106-
}
92+
"comment": "test",
93+
"hint": {
94+
"_id": 1
95+
},
96+
"max": {
97+
"_id": 6
98+
},
99+
"maxTimeMS": 6000,
100+
"min": {
101+
"_id": 0
102+
},
103+
"returnKey": false,
104+
"showRecordId": false
107105
}
108106
},
109107
"expectations": [

test/test_command_monitoring_legacy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ def run_scenario(self):
109109
elif name == 'find':
110110
if 'sort' in args:
111111
args['sort'] = list(args['sort'].items())
112+
if 'hint' in args:
113+
args['hint'] = list(args['hint'].items())
112114
for arg in 'skip', 'limit':
113115
if arg in args:
114116
args[arg] = int(args[arg])

0 commit comments

Comments
 (0)