Skip to content

Commit 39c41b2

Browse files
committed
Fix $comment tests for MongoDB 3.1.x.
1 parent 77de378 commit 39c41b2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/test_cursor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,9 +1052,12 @@ def find():
10521052

10531053
run_with_profiling(find)
10541054

1055+
# MongoDB 3.1.5 changed the ns for commands.
1056+
regex = {'$regex': 'pymongo_test.(\$cmd|test)'}
1057+
10551058
def count():
10561059
self.db.test.find().comment('foo').count()
1057-
op = self.db.system.profile.find({'ns': 'pymongo_test.$cmd',
1060+
op = self.db.system.profile.find({'ns': regex,
10581061
'op': 'command',
10591062
'command.count': 'test',
10601063
'command.$comment': 'foo'})
@@ -1064,7 +1067,7 @@ def count():
10641067

10651068
def distinct():
10661069
self.db.test.find().comment('foo').distinct('type')
1067-
op = self.db.system.profile.find({'ns': 'pymongo_test.$cmd',
1070+
op = self.db.system.profile.find({'ns': regex,
10681071
'op': 'command',
10691072
'command.distinct': 'test',
10701073
'command.$comment': 'foo'})

0 commit comments

Comments
 (0)