summaryrefslogtreecommitdiff
path: root/jstests/tool/dumprestore6.js
blob: d8b349e9589f132ecb6be73e68a016c30d06905a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// dumprestore6.js
// Test restoring from a dump with an old index version

t = new ToolTest( "dumprestore6" );

c = t.startDB( "foo" );
db = t.db
assert.eq( 0 , c.count() , "setup1" );

t.runTool("restore", "--dir", "jstests/tool/data/dumprestore6", "--db", "jstests_tool_dumprestore6")

assert.soon( "c.findOne()" , "no data after sleep" );
assert.eq( 1 , c.count() , "after restore" );
assert.eq( 1 , db.system.indexes.findOne({name:'a_1'}).v, "index version wasn't updated")
assert.eq( 1, c.count({v:0}), "dropped the 'v' field from a non-index collection")

db.dropDatabase()
assert.eq( 0 , c.count() , "after drop" );

t.runTool("restore", "--dir", "jstests/tool/data/dumprestore6", "--db", "jstests_tool_dumprestore6", "--keepIndexVersion")

assert.soon( "c.findOne()" , "no data after sleep2" );
assert.eq( 1 , c.count() , "after restore2" );
assert.eq( 0 , db.system.indexes.findOne({name:'a_1'}).v, "index version wasn't maintained")
assert.eq( 1, c.count({v:0}), "dropped the 'v' field from a non-index collection")

t.stop();