From 2739b152dba81f871c1bc8986b33348f58a34b48 Mon Sep 17 00:00:00 2001 From: noisersup Date: Thu, 22 Jun 2023 11:40:56 +0200 Subject: [PATCH] remove unreachable code --- .../stages/projection/projection.go | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/internal/handlers/common/aggregations/stages/projection/projection.go b/internal/handlers/common/aggregations/stages/projection/projection.go index ea4ac28aa485..1bdcb1ab6db2 100644 --- a/internal/handlers/common/aggregations/stages/projection/projection.go +++ b/internal/handlers/common/aggregations/stages/projection/projection.go @@ -248,22 +248,6 @@ func ProjectDocument(doc, projection *types.Document, inclusion bool) (*types.Do var op operators.Operator var value any - if !operators.IsOperator(idValue) { - if idValue.Len() == 0 { - return nil, commonerrors.NewCommandErrorMsgWithArgument( - commonerrors.ErrEmptySubProject, - "Invalid $project :: caused by :: An empty sub-projection is not a valid value."+ - " Found empty object at path", - "$project (stage)", - ) - } - - projected.Set("_id", idValue) - set = true - - break - } - op, err = operators.NewOperator(idValue) if err != nil { return nil, processOperatorError(err) @@ -282,6 +266,7 @@ func ProjectDocument(doc, projection *types.Document, inclusion bool) (*types.Do projected.Set("_id", idValue) set = true + case bool: set = idValue @@ -345,21 +330,6 @@ func projectDocumentWithoutID(doc *types.Document, projection *types.Document, i var op operators.Operator var v any - if !operators.IsOperator(value) { - if value.Len() == 0 { - return nil, commonerrors.NewCommandErrorMsgWithArgument( - commonerrors.ErrEmptySubProject, - "Invalid $project :: caused by :: An empty sub-projection is not a valid value."+ - " Found empty object at path", - "$project (stage)", - ) - } - - projected.Set(key, value) - - break - } - op, err = operators.NewOperator(value) if err != nil { return nil, processOperatorError(err)