Skip to content

Commit

Permalink
remove unreachable code
Browse files Browse the repository at this point in the history
  • Loading branch information
noisersup committed Jun 22, 2023
1 parent a798dd4 commit 2739b15
Showing 1 changed file with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -282,6 +266,7 @@ func ProjectDocument(doc, projection *types.Document, inclusion bool) (*types.Do
projected.Set("_id", idValue)

set = true

case bool:
set = idValue

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 2739b15

Please sign in to comment.