summaryrefslogtreecommitdiff
path: root/jstests/rename_stayTemp.js
blob: 2191485718971f51cc1a54f517c1d0efee123270 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)});
assert.eq(db.system.namespaces.findOne({name:ns(dest)}).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)