From c7fb8dfebd386d3e995f1d14343291c5b7898c65 Mon Sep 17 00:00:00 2001 From: Robert Guo Date: Fri, 5 Feb 2016 15:43:42 -0500 Subject: Revert "SERVER-21388 validate captrunc argument" This reverts commit f2a67700a3cfd9e401feb4a17931ea3209f10e4b. --- jstests/noPassthroughWithMongod/capped_truncate.js | 7 ------- src/mongo/db/commands/test_commands.cpp | 6 ------ 2 files changed, 13 deletions(-) diff --git a/jstests/noPassthroughWithMongod/capped_truncate.js b/jstests/noPassthroughWithMongod/capped_truncate.js index ce559919b80..ddba2420bba 100644 --- a/jstests/noPassthroughWithMongod/capped_truncate.js +++ b/jstests/noPassthroughWithMongod/capped_truncate.js @@ -11,13 +11,6 @@ autoIndexId: true })); var t = db.capped_truncate; - // It is an error to remove a non-positive number of documents. - assert.commandFailed(db.runCommand({ captrunc: "capped_truncate", n: -1 }), - "captrunc didn't return an error when attempting to remove a negative " + - "number of documents"); - assert.commandFailed(db.runCommand({ captrunc: "capped_truncate", n: 0 }), - "captrunc didn't return an error when attempting to remove 0 documents"); - for (var j = 1; j <= 10; j++) { assert.writeOK(t.insert({x:j})); } diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp index 9a2c5cec5cd..3cbc36519ba 100644 --- a/src/mongo/db/commands/test_commands.cpp +++ b/src/mongo/db/commands/test_commands.cpp @@ -189,13 +189,7 @@ public: int n = cmdObj.getIntField("n"); bool inc = cmdObj.getBoolField("inc"); // inclusive range? - if (n <= 0) { - return appendCommandStatus(result, - {ErrorCodes::BadValue, "n must be a positive integer"}); - } - Client::WriteContext ctx(txn, nss.ns()); - Collection* collection = ctx.getCollection(); massert(13417, "captrunc collection not found or empty", collection); -- cgit v1.2.1