# 6. 복합 메타에서 좋아요 기능을 사용하고 싶어요.

{% hint style="info" %}
고급자를 위한 가이드에요.

메타 코드를 볼 줄 아시는 분께 추천드려요.
{% endhint %}

복합 메타에서 좋아요 기능을 사용하려면 어떻게 해야 할까요?

좋아요는 3가지 정보가 필요해요. (게시글의 id, 메타 코드, 컬렉션 명)

그래서 복합 메타에서 사용하려면 메타 코드로 위 3가지 정보를 지정해 줘야 해요.

<div align="left"><figure><img src="/files/C8CHLYVSeaeqymSIXAaB" alt="" width="375"><figcaption></figcaption></figure></div>

```
{
	"action": {
		"action": {
			"type": "isDataChange"
		},
		"collectionName": "community",
		"itemId": "preDocument._id.oid",
		"metaCode": "community",
		"type": "like"
	},
	"icon": "iconHeartFill",
	"id": "likeIcon",
	"lego": {
		"name": "icon"
	}
}
```

* **커스텀 헤더**에 아이콘 추가
* **좋아요 액션** 추가
* **isDataChange 액션** 추가
* 메타 코드로 들어가서 위처럼 작성 (collectionName, metaCode는 게시글의 단일 메타)

> 단, 설정하는 곳이 게시물을 눌렀을 때 나온 복합 메타여야 해요. (preDocument를 사용하기 때문)\
> **isDataChange 액션**은 좋아요를 눌렀을 때 바로 적용해 줘요.\
> 꼭 커스텀 헤더에서 이용해 주세요.
>
> 메타 코드 보는 법은 이 [가이드](/main/guide/dictionary/collection-name.md)를 참고해 주세요.

24.08.06 Jihwan


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ohmyapp.io/main/guide/faq/action/6.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
