
CollectionModify::arrayAppend는 기존의 데이터에 새로 추가되는 데이터를 합쳐주는 기능입니다.
기존의 데이터가 [\"apple\", \"banana\", \"cherry\"]이고, arrayAppend를 사용하여 [\"grape\", \"mango\"]를 추가한다면, 결과는 다음과 같습니다.
[\"apple\", \"banana\", \"cherry\", \"grape\", \"mango\"]
기존의 데이터와 새로 추가되는 데이터가 중복되는 경우, arrayAppend는 중복된 데이터를 제거하지 않고, 모두 추가합니다.
예를 들어, 기존의 데이터가 [\"apple\", \"banana\", \"cherry\"]이고, arrayAppend를 사용하여 [\"banana\", \"mango\"]를 추가한다면, 결과는 다음과 같습니다.
[\"apple\", \"banana\", \"cherry\", \"mango\"]
중복된 데이터인 \"banana\"는 모두 추가됩니다.
따라서, arrayAppend를 사용할 때 중복된 데이터를 제거하고 싶다면, 중복된 데이터를 제거하는 로직을 별도로 추가해야 합니다.
2025-03-23 00:37