blob: 3ece5d8269ca67f6bb794f0ba588bcdb8eb521e7 (
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
|
// @tags: [
// assumes_superuser_permissions,
// requires_fastcount,
// requires_non_retryable_commands,
// ]
(function() {
// SERVER-30406 Test that renaming system.views correctly invalidates the view catalog
'use strict';
const collName = "views_rename_test";
let coll = db.getCollection(collName);
db.view.drop();
coll.drop();
assert.commandWorked(db.createView("view", collName, []));
assert.writeOK(coll.insert({_id: 1}));
assert.eq(db.view.find().count(), 1, "couldn't find document in view");
assert.commandWorked(db.system.views.renameCollection("views", /*dropTarget*/ true));
assert.eq(db.view.find().count(),
0,
"find on view should have returned no results after renaming away system.views");
assert.commandWorked(db.views.renameCollection("system.views"));
assert.eq(db.view.find().count(),
1,
"find on view should have worked again after renaming system.views back in place");
})();
|