@@ -1028,9 +1028,13 @@ func (s *S) TestQueryExplain(c *C) {
10281028 query := coll .Find (nil ).Limit (2 )
10291029 err = query .Explain (m )
10301030 c .Assert (err , IsNil )
1031- c .Assert (m ["cursor" ], Equals , "BasicCursor" )
1032- c .Assert (m ["nscanned" ], Equals , 2 )
1033- c .Assert (m ["n" ], Equals , 2 )
1031+ if m ["queryPlanner" ] != nil {
1032+ c .Assert (m ["executionStats" ].(M )["totalDocsExamined" ], Equals , 2 )
1033+ } else {
1034+ c .Assert (m ["cursor" ], Equals , "BasicCursor" )
1035+ c .Assert (m ["nscanned" ], Equals , 2 )
1036+ c .Assert (m ["n" ], Equals , 2 )
1037+ }
10341038
10351039 n := 0
10361040 var result M
@@ -1072,8 +1076,16 @@ func (s *S) TestQueryHint(c *C) {
10721076 m := M {}
10731077 err = coll .Find (nil ).Hint ("a" ).Explain (m )
10741078 c .Assert (err , IsNil )
1075- c .Assert (m ["indexBounds" ], NotNil )
1076- c .Assert (m ["indexBounds" ].(M )["a" ], NotNil )
1079+
1080+ if m ["queryPlanner" ] != nil {
1081+ m = m ["queryPlanner" ].(M )
1082+ m = m ["winningPlan" ].(M )
1083+ m = m ["inputStage" ].(M )
1084+ c .Assert (m ["indexName" ], Equals , "a_1" )
1085+ } else {
1086+ c .Assert (m ["indexBounds" ], NotNil )
1087+ c .Assert (m ["indexBounds" ].(M )["a" ], NotNil )
1088+ }
10771089}
10781090
10791091func (s * S ) TestFindOneNotFound (c * C ) {
@@ -2401,7 +2413,7 @@ func (s *S) TestSafeParameters(c *C) {
24012413 // Tweak the safety parameters to something unachievable.
24022414 session .SetSafe (& mgo.Safe {W : 4 , WTimeout : 100 })
24032415 err = coll .Insert (M {"_id" : 1 })
2404- c .Assert (err , ErrorMatches , "timeout|timed out waiting for slaves" )
2416+ c .Assert (err , ErrorMatches , "timeout|timed out waiting for slaves|Not enough data-bearing nodes " )
24052417 if ! s .versionAtLeast (2 , 6 ) {
24062418 // 2.6 turned it into a query error.
24072419 c .Assert (err .(* mgo.LastError ).WTimeout , Equals , true )
0 commit comments