summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/aggregation/bugs/server3253.js6
-rw-r--r--src/mongo/db/pipeline/document_source_out.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/jstests/aggregation/bugs/server3253.js b/jstests/aggregation/bugs/server3253.js
index a689f4e321e..68c3f988965 100644
--- a/jstests/aggregation/bugs/server3253.js
+++ b/jstests/aggregation/bugs/server3253.js
@@ -84,12 +84,10 @@ test(inputDoesntExist,
[],
[]);
-if (0) { // SERVER-12586
// ensure we cant do dangerous things to system collections
-outputInSystem = db.system.server3253_out;
-assertErrorCode(input, {$out: outputInSystem.getName()}, 16994);
+var outputInSystem = db.system.server3253_out;
+assertErrorCode(input, {$out: outputInSystem.getName()}, 17385);
assert(!collectionExists(outputInSystem));
-}
// shoudn't leave temp collections laying around
assert.eq([], db.system.namespaces.find({name: /tmp\.agg_out/}).toArray());
diff --git a/src/mongo/db/pipeline/document_source_out.cpp b/src/mongo/db/pipeline/document_source_out.cpp
index 2fc597d7e9c..fca2e582958 100644
--- a/src/mongo/db/pipeline/document_source_out.cpp
+++ b/src/mongo/db/pipeline/document_source_out.cpp
@@ -171,6 +171,8 @@ namespace mongo {
elem.type() == String);
NamespaceString outputNs(pExpCtx->ns.db().toString() + '.' + elem.str());
+ uassert(17385, "Can't $out to special collection: " + elem.str(),
+ !outputNs.isSpecial());
return new DocumentSourceOut(outputNs, pExpCtx);
}