Files
mongo/jstests/core/views/duplicate_ns.js
Max Hirschhorn 9ad8d6335f SERVER-40076 Tag JS tests with reason they're unable to run in Atlas.
There are likely more JavaScript tests which have been added since
r3.6.9 that still need to be tagged.

(cherry picked from commit 05ec08fa62)
2019-03-11 18:17:29 -04:00

30 lines
860 B
JavaScript

// @tags: [
// assumes_superuser_permissions,
// requires_non_retryable_writes,
// ]
// Test the creation of view with a duplicate name to a collection.
(function() {
"use strict";
const dbName = "views_duplicate_ns";
const viewsDb = db.getSiblingDB(dbName);
const collName = "myns";
const viewId = dbName + "." + collName;
assert.commandWorked(viewsDb.dropDatabase());
assert.writeOK(viewsDb.system.views.remove({_id: viewId}));
assert.commandWorked(viewsDb.runCommand({create: collName}));
assert.writeOK(viewsDb.system.views.insert({
_id: viewId,
viewOn: "coll",
pipeline: [],
}));
assert.eq(2,
viewsDb.getCollectionInfos()
.filter(coll => {
return coll.name === collName;
})
.length);
}());