프로토타입 · 미리 보기: 공식 레지스트리의 모든 서버를 담고 있으며 30분마다 동기화해요. Google로 로그인하면 리뷰를 쓸 수 있어요.프로토타입 · 30분마다 업데이트
PopNx MCPAI를 쓰는 사람을 위한 MCP 서버 · 쉬운 말로 설명해요

mongodb-odm Skill

저장소 ↗

제작자: doctrine★ 1,098skill 1개

설치

What it does

The Official PHP MongoDB ORM/ODM

  • Connects Instruction files the AI reads, with steps that call an outside service
  • Account or key Some steps need a key for MDB_MCP_API_CLIENT_SECRET (per the README)
  • Category 기타
제작자용: README에 배지 달기

제작자라면 이 코드를 README에 붙여 넣으세요. 배지는 이 페이지로 연결됩니다.

[![Featured on PopNx MCP](https://mcp.popnx.com/badge/skill/doctrine-mongodb-odm.svg)](https://mcp.popnx.com/en/skills/doctrine-mongodb-odm)

비슷한 Skill

같은 종류의 작업, Skill 목록과 같은 순서

비슷한 항목과 비교
이 항목
mongodb-odm
llmfitclaude-videoVideoCaptionerclaude-cookbooks
제작자doctrineAlexsJonesbradautomatesWEIFENG2333anthropics
Skill 수11114
GitHub 별1,09839,03621,08516,55754,799
마지막 코드 변경2026년 11월 13일2026년 11월 16일2026년 9월 25일2026년 9월 12일2026년 11월 5일
라이선스MITMITMITGPL-3.0MIT

doctrine의 Skill(지시 묶음) 1개, AI가 읽고 그대로 일해요 · MCP server가 아니에요

Skill과 MCP의 차이

MCP = 손

AI를 외부 서비스나 데이터에 연결합니다(예: Notion 읽기, 청구서 만들기). 프로그램이나 서버가 실행 중이어야 합니다.

Skill = 안내서

작업 방법을 AI에게 가르치는 텍스트 파일. 어떤 서비스에도 연결되지 않습니다.

겹치는 경우도 있습니다. 도구를 부르는 스크립트가 있는 Skill도, 지식만 보내는 MCP도 있습니다. 하려는 작업을 기준으로 고르세요.

쓸 수 있는 앱

제작자가 밝히지 않음 · SKILL.md 형식 Skill은 Claude Code, Codex, Cursor 같은 Agent Skills 지원 앱에서 써요

설치

Is it safe?

  • Who made it

    GitHub account doctrine (organization), 16 years old

  • Use and upkeep

    ★ 1,098 stars · code last changed 2026년 11월 13일

  • Any scripts?

    No, plain text files the AI reads and follows

  • Uses the internet?

    No scripts, so it does not go online by itself

  • Changes machine-wide settings?

    No hooks or writes to machine settings found

Checked automatically from the repo files at commit 97711ab (read only, nothing was run). Not a safety guarantee: read it and decide for yourself

먼저: 어떤 AI를 쓰시나요

쓰는 앱을 고르면 그 앱의 설치 방법만 보여 드립니다

Option 1Upload to claude.ai (web and app)

Uploading to claude.ai would fail: the description is over 200 characters (904). Use "Let the AI install it" instead

Option 1Claude Code에게 설치 맡기기

이 문장을 복사해 Claude Code 채팅에 붙여 넣으세요

Where to install
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) for all my projects, at ~/.claude/skills/mongodb-odm. First show me every file and tell me whether it has scripts or changes machine settings, then tell me the full path you will install to and wait for me to agree.
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) into the project this chat is open in (at .claude/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the project name and the full path you will install to and wait for me to agree.

For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing

The AI tells you what it will do first and asks your permission at every step

Claude Code를 다시 열고 /mongodb-odm를 입력하거나 관련 작업을 요청하면 Claude가 알아서 써요

Checked against official docs 2026년 11월 12일 · Source: code.claude.com

For Terminal users

Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.

  1. 터미널 열기

    Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요

  2. skill 폴더를 ~/.claude/skills에 복사

    repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요

    git clone --depth 1 https://github.com/doctrine/mongodb-odm.git /tmp/popnx-skill-doctrine-mongodb-odm-97711ab && mkdir -p ~/.claude/skills && cp -R '/tmp/popnx-skill-doctrine-mongodb-odm-97711ab/skills/mongodb-odm' ~/.claude/skills/mongodb-odm
  3. Claude Code를 다시 열고 /mongodb-odm를 입력하거나 관련 작업을 요청하면 Claude가 알아서 써요

직접 설치한 Skill은 ChatGPT 데스크톱 앱, Codex CLI, IDE의 Codex 확장 프로그램에서 쓸 수 있습니다 · 웹과 모바일의 ChatGPT에서는 직접 설치한 Skill을 쓸 수 없고 디렉터리의 플러그인에 들어 있는 Skill만 쓸 수 있습니다

ChatGPT 데스크톱 앱

ChatGPT 데스크톱 앱에는 Codex가 들어 있고, Codex는 ~/.agents/skills 폴더에서 Skill을 읽습니다

Option 1ChatGPT에게 설치 맡기기

ChatGPT 데스크톱 앱에서 Codex를 열고 이 문장을 채팅에 붙여 넣으세요

Where to install
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) for all my projects, at ~/.agents/skills/mongodb-odm. First show me every file and tell me whether it has scripts or changes machine settings, then tell me the full path you will install to and wait for me to agree.
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) into the project this chat is open in (at .agents/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the project name and the full path you will install to and wait for me to agree.

The AI always shows you the path before installing

The AI tells you what it will do first and asks your permission at every step

Option 2폴더를 직접 넣기

mongodb-odm 폴더를 ~/.agents/skills/mongodb-odm에 넣으세요

~는 홈 폴더($HOME)입니다

For Terminal users

Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.

  1. 터미널 열기

    Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요

  2. skill 폴더를 ~/.agents/skills에 복사

    repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요

    git clone --depth 1 https://github.com/doctrine/mongodb-odm.git /tmp/popnx-skill-doctrine-mongodb-odm-97711ab && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-doctrine-mongodb-odm-97711ab/skills/mongodb-odm' ~/.agents/skills/mongodb-odm

설치한 뒤

  • ChatGPT 데스크톱 앱: 사이드바에서 Skills를 열어 Skill이 보이는지 확인하세요
  • 쓰는 법: ChatGPT에서는 @를 입력하고 Skill을 고르세요 · Codex CLI나 IDE 확장 프로그램에서는 /skills를 실행하거나 $ 뒤에 Skill 이름을 입력하세요
  • Codex는 새로 설치한 Skill을 스스로 찾습니다. 보이지 않으면 Codex를 다시 시작하세요

Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com

웹과 모바일의 ChatGPT

직접 설치한 Skill은 쓸 수 없고, 디렉터리의 플러그인에 들어 있는 Skill만 쓸 수 있습니다

이 Skill을 ChatGPT에서 쓰려면 위 방법대로 ChatGPT 데스크톱 앱을 쓰세요

Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com

Option 1Codex에게 설치 맡기기

이 문장을 복사해 Codex 채팅에 붙여 넣으세요 · ChatGPT 데스크톱 앱 안의 Codex, Codex CLI, IDE 확장 프로그램에서 모두 쓸 수 있습니다

Where to install
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) for all my projects, at ~/.agents/skills/mongodb-odm. First show me every file and tell me whether it has scripts or changes machine settings, then tell me the full path you will install to and wait for me to agree.
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) into the project this chat is open in (at .agents/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the project name and the full path you will install to and wait for me to agree.

For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing

The AI tells you what it will do first and asks your permission at every step

Codex는 새로 설치한 Skill을 스스로 찾습니다. 보이지 않으면 Codex를 다시 시작하세요 · 쓰는 법: ChatGPT에서는 @를 입력하고 Skill을 고르세요 · Codex CLI나 IDE 확장 프로그램에서는 /skills를 실행하거나 $ 뒤에 Skill 이름을 입력하세요

Checked against official docs 2026년 11월 15일 · Source: learn.chatgpt.com

For Terminal users

Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.

  1. 터미널 열기

    Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요

  2. skill 폴더를 ~/.agents/skills에 복사

    repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요

    git clone --depth 1 https://github.com/doctrine/mongodb-odm.git /tmp/popnx-skill-doctrine-mongodb-odm-97711ab && mkdir -p ~/.agents/skills && cp -R '/tmp/popnx-skill-doctrine-mongodb-odm-97711ab/skills/mongodb-odm' ~/.agents/skills/mongodb-odm
  3. Codex를 다시 열고 관련 작업을 요청하면 Codex가 skill을 목록에 보여 줘요

Option 1Cursor에게 설치 맡기기

이 문장을 복사해 Cursor 채팅에 붙여 넣으세요

Where to install
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) for all my projects, at ~/.cursor/skills/mongodb-odm. First show me every file and tell me whether it has scripts or changes machine settings, then tell me the full path you will install to and wait for me to agree.
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) into the project this chat is open in (at .cursor/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the project name and the full path you will install to and wait for me to agree.

For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing

The AI tells you what it will do first and asks your permission at every step

Cursor Agent 채팅에서 /를 입력하고 mongodb-odm 선택

Checked against official docs 2026년 11월 12일 · Source: cursor.com

For Terminal users

Skill은 AI가 따르는 지시예요. 설치 전에 파일을 읽고, 믿을 수 있는 제작자 것만 설치하세요.

  1. 터미널 열기

    Mac: Command+스페이스 후 Terminal 입력 · Windows: 아래 명령은 PowerShell에서 안 돼요. 위의 “AI에게 설치 맡기기”를 쓰세요

  2. skill 폴더를 ~/.cursor/skills에 복사

    repo를 임시 폴더에 내려받고 SKILL.md가 있는 폴더만 복사해요

    git clone --depth 1 https://github.com/doctrine/mongodb-odm.git /tmp/popnx-skill-doctrine-mongodb-odm-97711ab && mkdir -p ~/.cursor/skills && cp -R '/tmp/popnx-skill-doctrine-mongodb-odm-97711ab/skills/mongodb-odm' ~/.cursor/skills/mongodb-odm
  3. Cursor Agent 채팅에서 /를 입력하고 mongodb-odm 선택

Option 1Let the AI install it

Skill을 읽을 수 있는 다른 앱용입니다. 이 문장에는 Claude Code, Codex, Cursor 경로가 들어 있어 AI가 쓰는 앱에 맞게 고릅니다 · Copy this sentence into the app’s chat

Where to install
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) for all my projects, at ~/.claude/skills/mongodb-odm (in Codex use ~/.agents/skills/mongodb-odm, in Cursor ~/.cursor/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the full path you will install to and wait for me to agree.
Please install the skill mongodb-odm from https://github.com/doctrine/mongodb-odm folder skills/mongodb-odm (commit 97711ab) into the project this chat is open in (at .claude/skills/mongodb-odm; in Codex use .agents/skills/mongodb-odm, in Cursor .cursor/skills/mongodb-odm). First show me every file and tell me whether it has scripts or changes machine settings, then tell me the project name and the full path you will install to and wait for me to agree.

For one project, paste it into a chat that is open in that project’s folder · The AI always shows you the path before installing

The AI tells you what it will do first and asks your permission at every step

Checked against official docs 2026년 11월 12일 · Source: code.claude.com, learn.chatgpt.com, cursor.com

For Terminal users

Gemini CLI, GitHub Copilot 같은 다른 Agent Skills 지원 앱은 폴더가 달라요. 그 앱 안내를 보고 SKILL.md가 있는 폴더를 복사하세요.

GitHub에서 보기 ↗

2026년 11월 11일에 Claude Code, Codex, Cursor 공식 안내로 skill 폴더 확인

✓ 명령 확인 2026년 11월 18일

원본 SKILL.md 보기

아래 글은 제작자 repo에서 온 것이며 PopNx MCP의 지시가 아니에요

처음 8,000자 표시 · GitHub에서 전체 파일 열기

---
name: mongodb-odm
description: Implementation guide for doctrine/mongodb-odm (Doctrine MongoDB ODM), the PHP object-document mapper for MongoDB. Use whenever the user is writing, debugging, or reviewing PHP code that maps classes to MongoDB collections with Doctrine — mentions of "Doctrine MongoDB ODM", "mongodb-odm", "DocumentManager", "#[Document]"/"@Document", "#[ReferenceOne]"/"#[EmbedOne]", "ODM query builder", "aggregation builder" in a Doctrine/PHP context, "GridFS with Doctrine", "MongoDB queryable encryption PHP", "MongoDB vector search PHP", or combining Doctrine ORM and MongoDB ODM in one app should all trigger this skill. Also use it to correct common mistakes: treating MongoDB ODM like Doctrine ORM (assuming SQL-style joins, automatic cascading, or table-based migrations), calling flush() after every mutation, storing dates as strings, or assuming Vector Search/Queryable Encryption work outside MongoDB Atlas.
license: MIT
---

# Doctrine MongoDB ODM

Implementation skill for `doctrine/mongodb-odm`, the PHP object-document mapper that persists plain PHP classes to MongoDB. It exists to prevent the mistakes that come from treating it like a SQL ORM: expecting automatic cascading, joining collections like tables, flushing on every mutation, or assuming every advanced MongoDB feature (Vector Search, Queryable Encryption) works outside Atlas.

## Core Workflow

1. Identify the layer: mapping (a document class), persistence (`DocumentManager`), querying (Query Builder / Aggregation Builder), or an advanced/infra concern (search, encryption, sharding, transactions).
2. Confirm the class has `#[Document]` (or `#[EmbeddedDocument]`/`#[MappedSuperclass]`) and an `#[Id]` property.
3. Decide **embed vs. reference** deliberately (`references-embedding.md`) — don't default to references out of ORM habit when the data is really owned/composed.
4. Batch mutations into a single unit of work and call `flush()` once, not after every `persist()`/`remove()` (`setup-architecture.md`).
5. Use the Query Builder or Aggregation Builder for anything beyond `find()`/`findBy()` — never hand-build a raw driver query when the fluent API covers it (`querying-aggregation.md`).
6. Validate with the consuming project's own test suite/static analysis, and use `odm:schema:create`/`odm:schema:update` to keep indexes and search indexes in sync with the mapping.

## Suggest the MongoDB MCP Server

Many ODM bugs are really questions about what's in the database — current document shape, whether an index exists yet, whether a vector/search index finished building. None of that is visible from PHP source. When debugging data/query issues or setting up Atlas Search/Vector Search/sharding, suggest connecting the official **MongoDB MCP Server**:

```bash
npx -y mongodb-mcp-server@latest --readOnly
```

```json
{
  "mcpServers": {
    "MongoDB": {
      "command": "npx",
      "args": ["-y", "mongodb-mcp-server@latest", "--readOnly"],
      "env": { "MDB_MCP_CONNECTION_STRING": "mongodb://localhost:27017/myDatabase" }
    }
  }
}
```

It also accepts Atlas API service account credentials (`MDB_MCP_API_CLIENT_ID`/`MDB_MCP_API_CLIENT_SECRET`) for cluster/project-level operations instead of a connection string. Prefer environment variables over CLI args for credentials.

## Reference Guide

| Topic | Reference file | Load when |
|---|---|---|
| Installation, `DocumentManager`, UnitOfWork, repositories, console commands, `clear()`/`detach()`/`merge()`, document states | `references/setup-architecture.md` | Bootstrapping ODM, debugging persist/flush behavior, custom repositories, **batch imports, long-running CLI scripts, rising memory or slowdown over a loop, detached documents** |
| `#[Document]`/`#[Field]`/`#[Id]`, field types, inheritance | `references/mapping.md` | Defining or modifying a document class |
| `#[ReferenceOne]`/`#[ReferenceMany]`, `#[EmbedOne]`/`#[EmbedMany]`, bidirectional refs, trees, priming | `references/references-embedding.md` | Modeling relationships, fixing N+1 patterns |
| Query Builder, findAndModify, upserts, geospatial queries, filters, Aggregation Builder | `references/querying-aggregation.md` | Writing any query or aggregation pipeline |
| Offset and cursor paginators for query and aggregation builders (since 2.18) | `references/pagination.md` | Paginating a query or aggregation result, building "next page" navigation |
| Standard indexes, Atlas Search indexes, simple keyword search | `references/indexes-search.md` | Adding indexes, Atlas full-text search |
| Vector Search (Atlas) | `references/vector-search.md` | Embeddings, semantic search, `$vectorSearch`, hybrid text+vector search |
| Queryable Encryption (Atlas/Enterprise) | `references/queryable-encryption.md` | Encrypting sensitive fields, `#[Encrypt]` |
| Combining Doctrine ORM (SQL) and MongoDB ODM | `references/hybrid-orm-odm.md` | An app persists some data to SQL and some to MongoDB and needs them to interoperate |
| GridFS, capped collections, sharding, transactions/locking, change tracking, storage strategies, events, schema migration, time series | `references/storage-transactions-lifecycle.md` | File storage, sharding, locking, lifecycle callbacks, evolving a mapping |

## Constraints

### MUST DO

- Put `#[Document]` (or `#[EmbeddedDocument]`) plus `#[Id]` on every persisted class; `#[Id]` properties must never be `readonly` (the generator sets it externally).
- Use `DateTime`/`DateTimeImmutable` (preferably immutable) for dates — never store a date as a string.
- Batch changes and `flush()` once per logical unit of work (typically 0–2 times per HTTP request).
- Set `cascade` explicitly on `#[ReferenceOne]`/`#[ReferenceMany]` when you need cascading persist/remove — not automatic for references (it *is* automatic for embeds).
- Use `Doctrine\Common\Collections\Collection`/`ArrayCollection` (never a plain `array`) for `#[ReferenceMany]`/`#[EmbedMany]` properties.
- Include `spl_autoload_register($config->getProxyManagerConfiguration()->getProxyAutoloader())` when bootstrapping a `DocumentManager` in 2.16 — omitting it regenerates proxy classes on every request.
- Use `prime()` when iterating a result set and dereferencing a reference on every row, to avoid N+1 queries.
- Run `odm:schema:create`/`odm:schema:update` after adding/changing indexes, capped-collection options, or search/vector-search indexes — none of that happens implicitly on first insert beyond a plain collection.
- Confirm MongoDB Atlas (or Enterprise 7.0+ for Queryable Encryption) before recommending Vector Search, Atlas Search, or Queryable Encryption.
- **State prerequisites and deprecations in the answer itself**, not just internally: when a feature needs a minimum ODM version (e.g. `vectorSearch()` needs 2.13+, Automated Embeddings 2.17+, `pipeline()` updates 2.15+) or a specific platform, say so; when the mapping the user is reaching for is deprecated (e.g. `COLLECTION_PER_CLASS` since 2.17, the `UUID` id strategy), say that too. The user cannot see these files — an unstated prerequisite is a missing answer.

### MUST NOT DO

- Don't call `flush()` after every `persist()`/`remove()`/`merge()` — batch changes and flush once per unit of work instead.
- Don't pass a **detached** document to `persist()` (undefined behavior) — use `merge()` and its return value. Calling `remove()` on one **throws**, it does not no-op.
- Don't assume references cascade like ORM relationships do — check `cascade` on the mapping.
- Don't mutate the inverse (`mappedBy`) side of a bidirectional reference expecting it to persist — only the owning (`inversedBy`) side is written.
- Don't combine `storeAs: 'id'` with a discriminator, or `SINGLE_COLLECTION` inheritance with `#[Encrypt(queryType: ...)]`.
- Don't put arbitrary PHP objects (e.g. `\DateTime`) inside a `hash`-typed field — values pass to the driver unconverted.
- Don't assume `#[AlsoLoad]` affects queries — it only affects hydration.
- Don't invent a native ORM↔ODM relationship attrib

토론

질문하고, 팁을 나누고, 안 되는 점을 알려 주세요. "도움이 됨"이 많은 순서예요.

아직 글이 없어요. 처음으로 질문하거나 공유해 보세요.

이곳의 글은 사용자가 쓴 것으로, PopNx 팀의 글이 아니에요.

로그인하고 글쓰기

GitHub 정보

GitHub 스타
1,098
제작자
doctrine
라이선스
MIT
최근 코드 수정
2026년 11월 13일
repo 안 SKILL.md(번역본과 템플릿 포함)
1
토픽
mongodb, odm, orm, php, symfony