summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/projection_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/projection_parser.cpp')
-rw-r--r--src/mongo/db/query/projection_parser.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/mongo/db/query/projection_parser.cpp b/src/mongo/db/query/projection_parser.cpp
index 3495f99f8f2..afb3c12556e 100644
--- a/src/mongo/db/query/projection_parser.cpp
+++ b/src/mongo/db/query/projection_parser.cpp
@@ -510,16 +510,7 @@ void parseSubObject(ParseContext* ctx,
// It was likely intended to be an expression. Check if it's a valid field path or not to
// confirm.
try {
- const auto elementFieldName = obj.firstElementFieldNameStringData();
- if (!hasPositionalOperator(elementFieldName)) {
- FieldPath fp(elementFieldName);
- } else {
- // The 'FieldPath' parser doesn't take positional operators into account, but those
- // are valid path projections so trim it off for this validation.
- StringData pathWithoutPositionalOperator =
- elementFieldName.substr(0, elementFieldName.size() - 2);
- FieldPath fp(pathWithoutPositionalOperator);
- }
+ FieldPath fp(obj.firstElementFieldNameStringData());
} catch (const DBException&) {
uasserted(31325,
str::stream()
@@ -640,8 +631,10 @@ Projection parseAndAnalyze(boost::intrusive_ptr<ExpressionContext> expCtx,
invariant(root.removeChild("_id"));
}
- // Optimize the projection expression if requested.
- if (shouldOptimize) {
+ // Optimize the projection expression if requested and as long as not explicitly disabled
+ // pipeline optimization.
+ auto fp = globalFailPointRegistry().find("disablePipelineOptimization");
+ if (shouldOptimize && !(fp && fp->shouldFail())) {
optimizeProjection(&root);
}