2011-12-16 01:46:39 +01:00
|
|
|
// this is to make sure that temp collections get cleaned up on restart
|
|
|
|
|
|
|
|
testname = 'temp_namespace_sw'
|
2013-09-26 03:59:42 +02:00
|
|
|
path = MongoRunner.dataPath+testname
|
2011-12-16 01:46:39 +01:00
|
|
|
|
|
|
|
conn = startMongodEmpty("--port", 30000, "--dbpath", path, "--smallfiles", "--noprealloc", "--nopreallocj");
|
|
|
|
d = conn.getDB('test')
|
|
|
|
d.runCommand({create: testname+'temp1', temp: true});
|
2013-02-28 19:13:47 +01:00
|
|
|
d[testname+'temp1'].ensureIndex({x:1});
|
2011-12-16 01:46:39 +01:00
|
|
|
d.runCommand({create: testname+'temp2', temp: 1});
|
2013-02-28 19:13:47 +01:00
|
|
|
d[testname+'temp2'].ensureIndex({x:1});
|
2011-12-16 01:46:39 +01:00
|
|
|
d.runCommand({create: testname+'keep1', temp: false});
|
|
|
|
d.runCommand({create: testname+'keep2', temp: 0});
|
|
|
|
d.runCommand({create: testname+'keep3'});
|
|
|
|
d[testname+'keep4'].insert({});
|
|
|
|
|
2014-10-28 17:25:03 +01:00
|
|
|
function countCollectionNames( theDB, regex ) {
|
|
|
|
return theDB.getCollectionNames().filter( function(z) {
|
|
|
|
return z.match( regex ); } ).length;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert.eq(countCollectionNames( d, /temp\d$/) , 2)
|
|
|
|
assert.eq(countCollectionNames( d, /keep\d$/) , 4)
|
2011-12-16 01:46:39 +01:00
|
|
|
stopMongod(30000);
|
|
|
|
|
|
|
|
conn = startMongodNoReset("--port", 30000, "--dbpath", path, "--smallfiles", "--noprealloc", "--nopreallocj");
|
|
|
|
d = conn.getDB('test')
|
2014-10-28 17:25:03 +01:00
|
|
|
assert.eq(countCollectionNames( d, /temp\d$/) , 0)
|
|
|
|
assert.eq(countCollectionNames( d, /keep\d$/) , 4)
|
2011-12-16 01:46:39 +01:00
|
|
|
stopMongod(30000);
|