> For the complete documentation index, see [llms.txt](https://docs.ohmyapp.io/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/conditions/detailed-processing-conditions/query.md).

# @query

* 특정 메타(Collection)에서 데이터(Document)를 가져올 때 사용해요.&#x20;

ex) 다른 유저의 정보 가져오기, 현재 유저의 작성 글 전체 가져오기, 현재 유저의 구독 상태 확인하기, 현재 글의 전체 댓글 가져오기 등

**사용 방법**

<figure><img src="/files/iXnbLo7aZCNlBeFfOJ7c" alt=""><figcaption></figcaption></figure>

1. 로직 설정 ➡︎ If When, Where에 원하는 값 입력 ➡︎ New data query 를 펼쳐 주세요. &#x20;
2. Event에서 @query를 드래그앤드롭하여 원하는 위치(flows, #ifTrue, #ifFalse, @for)에 넣어주세요.

<div align="left"><figure><img src="/files/Cr9454suqOIZExyDcxyl" alt="" width="563"><figcaption></figcaption></figure></div>

위의 예시 이미지와 같이 #collection과 #find에 값을 넣어주세요.

* \#collection에는 찾고 싶은 데이터(Document) 의 메타(collection) 이름이 들어가요.
* \#find에는 찾고 싶은 Document 조건이 들어가요.

**필드 설명**

* query

  * \#collection (String) (필수)&#x20;

    찾고 싶은 Document 의 Collection 이름이에요.
  * \#find (String) (필수)&#x20;

    찾고 싶은 Document 의 조건(필터)이에요.

    Object 내부의 value는 모든 데이터 형과 동적 키가 허용돼요.

    mongoDB  > find의 쿼리는 전부 허용돼요.&#x20;

  `[참고](https://www.mongodb.com/docs/manual/reference/method/db.collection.find/)`&#x20;

2024.01.16 Jinny


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic/conditions/detailed-processing-conditions/query.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
