# 로직

로직이란, "새로운 글이 등록되면, 푸시알림을 발송한다." 와 같이 "어떤 값이 입력되면 어떤 행동을 한다." 의 인과관계가 있는 일련의 과정이에요.&#x20;

로직을 만들 수 있으면 원하는 기능을 직접 구현할 수 있어요.&#x20;

오마이앱에서 로직을 만드는 방법은, 원하는 기능을 "\_하면 \_에서\_한다." 의 형식에 맞추어 작성하면 돼요.

* **If When** : 데이터가 처리되는 유형
* **Where** : 데이터가 처리되는 곳
* **Then** : 데이터가 처리된 후 진행될 활동

[로직 만들기 바로가기](/main/guide/develop_app/command-execute-function/create-logic.md)

**로직에서 사용하는 용어**

* 이전 데이터 (preDocument) : 사건 발생 이전 데이터예요.
* 새로운 데이터 (newDocument) : 사건 발생 이후 데이터예요.
* parentDocument : 발생한 사건의 부모가 되는 데이터예요. 예를 들면 '댓글 작성'이라는 사건이 발생했을 때, 댓글이 작성된 피드가 부모 데이터가 돼요.
* Document : 항목으로 이루어진 데이터예요.
* Collection : Document가 저장되는 위치예요.
* \_id : 데이터의 고유 ID예요. 이를 활용해서 원하는 Document(데이터)를 정확히 찾을 수 있어요.
* 임시 데이터 (tmpDocument) : 임시로 저장된 데이터예요. 데이터를 담아두거나 현재 로그인한 유저 정보 가져오기 등을 할 때 사용해요.
* 점 표기법 (“.”) : Document의 내부에 접근할 때 사용해요. 접근할 데이터 뒤에 점(.)을 입력하고, 원하는 항목명을 작성해서 내부 데이터 값을 사용할 수 있어요. 점(.)을 '의'라는 글자로 해석하면 이해가 쉬워요.

> **점 표기법 사용 예시**
>
> * 피드 작성자의 아바타\
>   { "id" : "\_createUser.avatar" }
> * 로그인한 유저의 닉네임\
>   { "id" : "userInfo.nickname" }
> * 이전 화면의 작성자 정보\
>   { "id" : "preDocument.\_createUser.\_id" }
> * 현재 화면에서 입력한 주소의 건물\
>   { "id" : "inputData.address.buildingName" }

> \#로직, #로직이란?, #푸시 알림, #결제 기능, #로직 설정, #이벤트 옵션, #세부 처리 조건, #플로우 옵션, #preDocument, #newDocument, #parentDocument, #Document, #Collection, #\_id, #tmpDocument, #점 표기법, #동적 키

2024.01.16 Jinny


---

# 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/dictionary/logic.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.
