mirror of https://github.com/mongodb/mongo
SERVER-114631 Remove isParsingPipeline in expCtx (#45032)
GitOrigin-RevId: c12a19e4bad2c2d3583389dc3828848392356884
This commit is contained in:
parent
e52b386d44
commit
366a3c17eb
|
|
@ -60,12 +60,34 @@ assert.commandFailedWithCode(
|
|||
40602,
|
||||
);
|
||||
|
||||
// $search is not allowed in an update pipeline. Error code matters on version.
|
||||
// $search is not allowed in an update pipeline.
|
||||
assert.commandFailedWithCode(testDB.runCommand({"findandmodify": collName, "update": [{"$search": {}}]}), [
|
||||
6600901,
|
||||
ErrorCodes.InvalidOptions,
|
||||
]);
|
||||
|
||||
// $search is not allowed in an update command pipeline.
|
||||
assert.commandFailedWithCode(
|
||||
testDB.runCommand({
|
||||
update: collName,
|
||||
updates: [{q: {_id: 0}, u: [{$search: {}}]}],
|
||||
}),
|
||||
ErrorCodes.InvalidOptions,
|
||||
);
|
||||
|
||||
// $searchMeta is not allowed in an update pipeline.
|
||||
assert.commandFailedWithCode(testDB.runCommand({"findandmodify": collName, "update": [{"$searchMeta": {}}]}), [
|
||||
ErrorCodes.InvalidOptions,
|
||||
]);
|
||||
|
||||
// $searchMeta is not allowed in an update command pipeline.
|
||||
assert.commandFailedWithCode(
|
||||
testDB.runCommand({
|
||||
update: collName,
|
||||
updates: [{q: {_id: 0}, u: [{$searchMeta: {}}]}],
|
||||
}),
|
||||
ErrorCodes.InvalidOptions,
|
||||
);
|
||||
|
||||
// Make sure the server is still up.
|
||||
assert.commandWorked(testDB.runCommand("ping"));
|
||||
|
||||
|
|
|
|||
|
|
@ -709,14 +709,6 @@ public:
|
|||
_params.isParsingViewDefinition = isParsingViewDefinition;
|
||||
}
|
||||
|
||||
bool getIsParsingPipelineUpdate() const {
|
||||
return _params.isParsingPipelineUpdate;
|
||||
}
|
||||
|
||||
void setIsParsingPipelineUpdate(bool isParsingPipelineUpdate) {
|
||||
_params.isParsingPipelineUpdate = isParsingPipelineUpdate;
|
||||
}
|
||||
|
||||
bool getIsParsingCollectionValidator() const {
|
||||
return _params.isParsingCollectionValidator;
|
||||
}
|
||||
|
|
@ -1132,8 +1124,6 @@ protected:
|
|||
bool inUnionWith = false;
|
||||
// True if this ExpressionContext is used to parse a view definition pipeline.
|
||||
bool isParsingViewDefinition = false;
|
||||
// True if this ExpressionContext is being used to parse an update pipeline.
|
||||
bool isParsingPipelineUpdate = false;
|
||||
// True if this ExpressionContext is used to parse a collection validator expression.
|
||||
bool isParsingCollectionValidator = false;
|
||||
// These fields can be used in a context when API version validations were not enforced
|
||||
|
|
|
|||
|
|
@ -174,12 +174,6 @@ ExpressionContextBuilder& ExpressionContextBuilder::isParsingViewDefinition(
|
|||
return *this;
|
||||
}
|
||||
|
||||
ExpressionContextBuilder& ExpressionContextBuilder::isParsingPipelineUpdate(
|
||||
bool isParsingPipelineUpdate) {
|
||||
params.isParsingPipelineUpdate = isParsingPipelineUpdate;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ExpressionContextBuilder& ExpressionContextBuilder::isParsingCollectionValidator(
|
||||
bool isParsingCollectionValidator) {
|
||||
params.isParsingCollectionValidator = isParsingCollectionValidator;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public:
|
|||
ExpressionContextBuilder& inLookup(bool);
|
||||
ExpressionContextBuilder& inUnionWith(bool);
|
||||
ExpressionContextBuilder& isParsingViewDefinition(bool);
|
||||
ExpressionContextBuilder& isParsingPipelineUpdate(bool);
|
||||
ExpressionContextBuilder& isParsingCollectionValidator(bool);
|
||||
ExpressionContextBuilder& isIdHackQuery(bool);
|
||||
ExpressionContextBuilder& isFleQuery(bool);
|
||||
|
|
|
|||
|
|
@ -124,10 +124,6 @@ InternalSearchMongotRemoteSpec prepareInternalSearchMetaMongotSpec(
|
|||
return internalSpec;
|
||||
}
|
||||
|
||||
uassert(6600901,
|
||||
"Running $searchMeta command in non-allowed context (update pipeline)",
|
||||
!expCtx->getIsParsingPipelineUpdate());
|
||||
|
||||
// If 'searchReturnEofImmediately' is set, we return this stage as is because we don't expect to
|
||||
// return any results. More precisely, we wish to avoid calling 'planShardedSearch' when no
|
||||
// mongot is set up.
|
||||
|
|
|
|||
|
|
@ -139,12 +139,10 @@ void parseUpdate(boost::intrusive_ptr<ExpressionContext> expCtx, ParsedUpdate& p
|
|||
parsedUpdate.driver->setSkipDotsDollarsCheck(true);
|
||||
}
|
||||
|
||||
expCtx->setIsParsingPipelineUpdate(true);
|
||||
parsedUpdate.driver->parse(*parsedUpdate.modification,
|
||||
*parsedUpdate.arrayFilters,
|
||||
parsedUpdate.request->getUpdateConstants(),
|
||||
parsedUpdate.request->isMulti());
|
||||
expCtx->setIsParsingPipelineUpdate(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue