diff options
author | David Storch <david.storch@10gen.com> | 2014-05-06 19:00:56 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-05-06 19:00:56 -0400 |
commit | 72380726608df663a85bee24d69a20ed2ca8287d (patch) | |
tree | 735b7724ddc814fdf385d754bd7921975b5de491 /jstests/repl/basic1.js | |
parent | 3061ab54eb2cc642a279becfca0b93f5e17db117 (diff) | |
download | mongo-72380726608df663a85bee24d69a20ed2ca8287d.tar.gz |
Revert "SERVER-13741 Migrate remaining tests to use write commands"
This reverts commit 87dc3ae516e1d12a632dc604710661e38ed7b3dd.
Diffstat (limited to 'jstests/repl/basic1.js')
-rw-r--r-- | jstests/repl/basic1.js | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/jstests/repl/basic1.js b/jstests/repl/basic1.js index a2ec3ceb52f..ccde8874fbd 100644 --- a/jstests/repl/basic1.js +++ b/jstests/repl/basic1.js @@ -25,7 +25,7 @@ function check( note ){ sleep( 200 ); } lastOpLogEntry = m.getDB("local").oplog.$main.find({op:{$ne:"n"}}).sort({$natural:-1}).limit(-1).next(); - note = note + tojson(am.a.find().toArray()) + " != " + tojson(as.a.find().toArray()) + note = note + tojson(am.a.find().toArray()) + " != " + tojson(as.a.find().toArray()) + "last oplog:" + tojson(lastOpLogEntry); assert.eq( x.md5 , y.md5 , note ); } @@ -44,8 +44,9 @@ check( "C" ); // ----- check features ------- // map/reduce -assert.writeOK(am.mr.insert({ tags: [ "a" ]})); -assert.writeOK(am.mr.insert({ tags: [ "a", "b" ]})); +am.mr.insert( { tags : [ "a" ] } ) +am.mr.insert( { tags : [ "a" , "b" ] } ) +am.getLastError(); check( "mr setup" ); m = function(){ @@ -86,19 +87,22 @@ block(); checkNumCollections( "MR4" ); -var t = am.rpos; -var writeOption = { writeConcern: { w: 2, wtimeout: 3000 }}; -t.insert({ _id: 1, a: [{ n: "a", c: 1 }, { n: "b", c: 1 }, { n: "c", c: 1 }], b: [ 1, 2, 3 ]}, - writeOption); + +t = am.rpos; +t.insert( { _id : 1 , a : [ { n : "a" , c : 1 } , { n : "b" , c : 1 } , { n : "c" , c : 1 } ] , b : [ 1 , 2 , 3 ] } ) +block(); check( "after pos 1 " ); -t.update({ "a.n": "b" }, { $inc: { "a.$.c": 1 }}, writeOption); +t.update( { "a.n" : "b" } , { $inc : { "a.$.c" : 1 } } ) +block(); check( "after pos 2 " ); -t.update({ b: 2 }, { $inc: { "b.$": 1 }}, writeOption); +t.update( { "b" : 2 } , { $inc : { "b.$" : 1 } } ) +block(); check( "after pos 3 " ); -t.update({ b: 3 }, { $set: { "b.$": 17 }}, writeOption); +t.update( { "b" : 3} , { $set : { "b.$" : 17 } } ) +block(); check( "after pos 4 " ); @@ -108,17 +112,23 @@ printjson( as.rpos.findOne() ) //am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().limit(10).sort( { $natural : -1 } ).forEach( printjson ) t = am.b; -var updateOption = { upsert: true, multi: false, writeConcern: { w: 2, wtimeout: 3000 }}; -t.update({ _id: "fun" }, { $inc: { "a.b.c.x": 6743 }}, updateOption); +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 6743} } , true, false) +block() check( "b 1" ); -t.update({ _id: "fun" }, { $inc: { "a.b.c.x": 5 }}, updateOption); +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 5} } , true, false) +block() check( "b 2" ); -t.update({ _id: "fun" }, { $inc: { "a.b.c.x": 100, "a.b.c.y": 911 }}, updateOption); +t.update( { "_id" : "fun"}, { $inc : {"a.b.c.x" : 100, "a.b.c.y" : 911} } , true, false) +block() assert.eq( { _id : "fun" , a : { b : { c : { x : 6848 , y : 911 } } } } , as.b.findOne() , "b 3" ); +//printjson( t.findOne() ) +//printjson( as.b.findOne() ) +//am.getSisterDB( "local" ).getCollection( "oplog.$main" ).find().sort( { $natural : -1 } ).limit(3).forEach( printjson ) check( "b 4" ); + // lots of indexes am.lotOfIndexes.insert( { x : 1 } ) @@ -126,8 +136,10 @@ for ( i=0; i<200; i++ ){ var idx = {} idx["x"+i] = 1; am.lotOfIndexes.ensureIndex( idx ); + am.getLastError() } + assert.soon( function(){ return am.lotOfIndexes.getIndexes().length == as.lotOfIndexes.getIndexes().length; } , "lots of indexes a" ) assert.eq( am.lotOfIndexes.getIndexes().length , as.lotOfIndexes.getIndexes().length , "lots of indexes b" ) @@ -142,8 +154,9 @@ assert.soon( function(){ z = as.mu1.findOne(); printjson( z ); return friendlyEq // profiling - this sould be last am.setProfilingLevel( 2 ) -am.foo.insert({ x: 1 }, writeOption); +am.foo.insert( { x : 1 } ) am.foo.findOne() +block(); assert.eq( 2 , am.system.profile.count() , "P1" ) assert.eq( 0 , as.system.profile.count() , "P2" ) |