@@ -1376,7 +1376,7 @@ func (s *S) TestFindAndModifyWriteConcern(c *C) {
1376
1376
defer session .Close ()
1377
1377
1378
1378
coll := session .DB ("mydb" ).C ("mycoll" )
1379
- err = coll .Insert (M {"fid " : 42 })
1379
+ err = coll .Insert (M {"id " : 42 })
1380
1380
c .Assert (err , IsNil )
1381
1381
1382
1382
// Tweak the safety parameters to something unachievable.
@@ -1391,15 +1391,14 @@ func (s *S) TestFindAndModifyWriteConcern(c *C) {
1391
1391
ReturnNew : false ,
1392
1392
}
1393
1393
info , err := coll .Find (M {"id" : M {"$exists" : true }}).Apply (change , & ret )
1394
- c .Assert (err , ErrorMatches , "timeout|timed out waiting for slaves|Not enough data-bearing nodes|waiting for replication timed out" )
1395
- if ! s .versionAtLeast (2 , 6 ) {
1396
- // 2.6 turned it into a query error.
1397
- c .Assert (err .(* mgo.LastError ).WTimeout , Equals , true )
1398
- }
1399
1394
c .Assert (info .Updated , Equals , 1 )
1400
1395
c .Assert (info .Matched , Equals , 1 )
1401
- c .Assert (info .UpsertedId , NotNil )
1402
- c .Assert (ret .Id , Equals , 50 )
1396
+ c .Assert (ret .Id , Equals , 42 )
1397
+
1398
+ if s .versionAtLeast (3 , 2 ) {
1399
+ // findAndModify support writeConcern after version 3.2.
1400
+ c .Assert (err , ErrorMatches , "timeout|timed out waiting for slaves|Not enough data-bearing nodes|waiting for replication timed out" )
1401
+ }
1403
1402
}
1404
1403
1405
1404
func (s * S ) TestFindAndModifyBug997828 (c * C ) {
0 commit comments