diff options
author | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2018-03-09 18:07:39 -0500 |
---|---|---|
committer | Nick Zolnierz <nicholas.zolnierz@mongodb.com> | 2018-03-20 12:17:48 -0400 |
commit | cd950b113ee0d00e88036b2fe6306866c7ba27f9 (patch) | |
tree | fc2cb2b8240fdc0f2fd38f47a4240c53e0b02d29 /src/mongo/db/matcher/expression_parser_test.cpp | |
parent | fd6f205a3ab17feec0cc9a0ba2a4baba8627f1f2 (diff) | |
download | mongo-cd950b113ee0d00e88036b2fe6306866c7ba27f9.tar.gz |
SERVER-30005: remove $isolated/$atomic option
Diffstat (limited to 'src/mongo/db/matcher/expression_parser_test.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_parser_test.cpp | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/mongo/db/matcher/expression_parser_test.cpp b/src/mongo/db/matcher/expression_parser_test.cpp index 4343cf60403..d2bcd91a1b4 100644 --- a/src/mongo/db/matcher/expression_parser_test.cpp +++ b/src/mongo/db/matcher/expression_parser_test.cpp @@ -65,56 +65,6 @@ TEST(MatchExpressionParserTest, Multiple1) { ASSERT(!result.getValue()->matchesBSON(BSON("x" << 5 << "y" << 4))); } -TEST(AtomicMatchExpressionTest, AtomicOperatorSuccessfullyParsesWhenFeatureBitIsSet) { - auto query = BSON("x" << 5 << "$atomic" << 1); - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto result = MatchExpressionParser::parse( - query, expCtx, ExtensionsCallbackNoop(), MatchExpressionParser::AllowedFeatures::kIsolated); - ASSERT_OK(result.getStatus()); -} - -TEST(AtomicMatchExpressionTest, AtomicOperatorFailsToParseIfNotTopLevel) { - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto query = BSON("x" << 5 << "y" << BSON("$atomic" << 1)); - auto result = MatchExpressionParser::parse( - query, expCtx, ExtensionsCallbackNoop(), MatchExpressionParser::AllowedFeatures::kIsolated); - ASSERT_NOT_OK(result.getStatus()); - ASSERT_EQ(ErrorCodes::BadValue, result.getStatus()); -} - -TEST(AtomicMatchExpressionTest, AtomicOperatorFailsToParseIfFeatureBitIsNotSet) { - auto query = BSON("x" << 5 << "$atomic" << 1); - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto result = MatchExpressionParser::parse(query, expCtx); - ASSERT_EQ(ErrorCodes::QueryFeatureNotAllowed, result.getStatus()); -} - -TEST(IsolatedMatchExpressionTest, IsolatedOperatorSuccessfullyParsesWhenFeatureBitIsSet) { - auto query = BSON("x" << 5 << "$isolated" << 1); - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto result = MatchExpressionParser::parse( - query, expCtx, ExtensionsCallbackNoop(), MatchExpressionParser::AllowedFeatures::kIsolated); - ASSERT_OK(result.getStatus()); -} - -TEST(IsolatedMatchExpressionTest, IsolatedOperatorFailsToParseIfFeatureBitIsNotSet) { - // Query parsing fails if $isolated is not in the allowed feature set. - auto query = BSON("x" << 5 << "$isolated" << 1); - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto result = MatchExpressionParser::parse(query, expCtx); - ASSERT_NOT_OK(result.getStatus()); - ASSERT_EQ(ErrorCodes::QueryFeatureNotAllowed, result.getStatus()); -} - -TEST(IsolatedMatchExpressionTest, IsolatedOperatorFailsToParseIfNotTopLevel) { - boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); - auto query = BSON("x" << 5 << "y" << BSON("$isolated" << 1)); - auto result = MatchExpressionParser::parse( - query, expCtx, ExtensionsCallbackNoop(), MatchExpressionParser::AllowedFeatures::kIsolated); - ASSERT_NOT_OK(result.getStatus()); - ASSERT_EQ(ErrorCodes::BadValue, result.getStatus()); -} - TEST(MatchExpressionParserTest, MinDistanceWithoutNearFailsToParse) { BSONObj query = fromjson("{loc: {$minDistance: 10}}"); boost::intrusive_ptr<ExpressionContextForTest> expCtx(new ExpressionContextForTest()); |