Skip to content

Commit

Permalink
remove obsolete check
Browse files Browse the repository at this point in the history
  • Loading branch information
noisersup committed Jan 12, 2023
1 parent fab6690 commit d0c3a32
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions internal/handlers/common/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,6 @@ func processRenameFieldExpression(doc *types.Document, update *types.Document) (
// this is covered in validateRenameExpression
renameValue := renameRawValue.(string)

// disallow fields where key is equal to the target
if key == renameRawValue {
return changed, NewWriteErrorMsg(
ErrBadValue,
fmt.Sprintf("The source and target field for $rename must differ: %s: %#v", key, renameValue),
)
}

sourcePath := types.NewPathFromString(key)
targetPath := types.NewPathFromString(renameValue)

Expand Down Expand Up @@ -752,6 +744,7 @@ func validateRenameExpression(update *types.Document) error {
)
}

// disallow fields where key is equal to the target
if k == vStr {
return NewWriteErrorMsg(
ErrBadValue,
Expand Down

0 comments on commit d0c3a32

Please sign in to comment.