diff options
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r-- | src/mongo/db/query/query_request.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/query/query_request_test.cpp | 25 |
2 files changed, 0 insertions, 29 deletions
diff --git a/src/mongo/db/query/query_request.cpp b/src/mongo/db/query/query_request.cpp index d8ab73b8116..d50d8a10f4d 100644 --- a/src/mongo/db/query/query_request.cpp +++ b/src/mongo/db/query/query_request.cpp @@ -263,10 +263,6 @@ StatusWith<unique_ptr<QueryRequest>> QueryRequest::parseFromFindCommand(unique_p qr->_wantMore = !el.boolean(); } else if (fieldName == kAllowDiskUseField) { - if (!getTestCommandsEnabled()) { - return Status(ErrorCodes::FailedToParse, - "allowDiskUse is not allowed unless test commands are enabled."); - } Status status = checkFieldType(el, Bool); if (!status.isOK()) { return status; diff --git a/src/mongo/db/query/query_request_test.cpp b/src/mongo/db/query/query_request_test.cpp index c2624e65ceb..4c6a5cd2f41 100644 --- a/src/mongo/db/query/query_request_test.cpp +++ b/src/mongo/db/query/query_request_test.cpp @@ -35,7 +35,6 @@ #include "mongo/db/catalog/collection_catalog.h" #include "mongo/db/catalog/collection_mock.h" -#include "mongo/db/commands/test_commands_enabled.h" #include "mongo/db/dbmessage.h" #include "mongo/db/json.h" #include "mongo/db/namespace_string.h" @@ -1082,10 +1081,6 @@ TEST(QueryRequestTest, DefaultQueryParametersCorrect) { } TEST(QueryRequestTest, ParseCommandAllowDiskUseTrue) { - const bool oldTestCommandsEnabledVal = getTestCommandsEnabled(); - ON_BLOCK_EXIT([&] { setTestCommandsEnabled(oldTestCommandsEnabledVal); }); - setTestCommandsEnabled(true); - BSONObj cmdObj = fromjson("{find: 'testns', allowDiskUse: true}"); const NamespaceString nss("test.testns"); const bool isExplain = false; @@ -1096,10 +1091,6 @@ TEST(QueryRequestTest, ParseCommandAllowDiskUseTrue) { } TEST(QueryRequestTest, ParseCommandAllowDiskUseFalse) { - const bool oldTestCommandsEnabledVal = getTestCommandsEnabled(); - ON_BLOCK_EXIT([&] { setTestCommandsEnabled(oldTestCommandsEnabledVal); }); - setTestCommandsEnabled(true); - BSONObj cmdObj = fromjson("{find: 'testns', allowDiskUse: false}"); const NamespaceString nss("test.testns"); const bool isExplain = false; @@ -1109,22 +1100,6 @@ TEST(QueryRequestTest, ParseCommandAllowDiskUseFalse) { ASSERT_EQ(false, result.getValue()->allowDiskUse()); } -TEST(QueryRequestTest, ParseCommandAllowDiskUseTestCommandsDisabled) { - const bool oldTestCommandsEnabledVal = getTestCommandsEnabled(); - ON_BLOCK_EXIT([&] { setTestCommandsEnabled(oldTestCommandsEnabledVal); }); - setTestCommandsEnabled(false); - - BSONObj cmdObj = fromjson("{find: 'testns', allowDiskUse: true}"); - const NamespaceString nss("test.testns"); - const bool isExplain = false; - auto result = QueryRequest::makeFromFindCommand(nss, cmdObj, isExplain); - - ASSERT_NOT_OK(result.getStatus()); - ASSERT_EQ(ErrorCodes::FailedToParse, result.getStatus().code()); - ASSERT_STRING_CONTAINS(result.getStatus().toString(), - "allowDiskUse is not allowed unless test commands are enabled."); -} - // // Extra fields cause the parse to fail. // |