summaryrefslogtreecommitdiff
path: root/jstests/rename_stayTemp.js
blob: afd77d1289c73a7be560e1ccef87f8ce80f41227 (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
orig = 'rename_stayTemp_orig'
dest = 'rename_stayTemp_dest'

db[orig].drop()
db[dest].drop()

function ns(coll){ return db[coll].getFullName() }

db.runCommand({create: orig, temp:1})
assert.eq(db.system.namespaces.findOne({name:ns(orig)}).options.temp, 1)

db.adminCommand({renameCollection: ns(orig), to: ns(dest)});
var options = db.system.namespaces.findOne({name:ns(dest)}).options || {};
assert.eq(options.temp, undefined);

db[dest].drop();

db.runCommand({create: orig, temp:1})
assert.eq(db.system.namespaces.findOne({name:ns(orig)}).options.temp, 1)

db.adminCommand({renameCollection: ns(orig), to: ns(dest), stayTemp: true});
assert.eq(db.system.namespaces.findOne({name:ns(dest)}).options.temp, 1)