docs(mongo-query-builder): fix pipeline builder examples to match the real API#928
docs(mongo-query-builder): fix pipeline builder examples to match the real API#928nurul3101 wants to merge 1 commit into
Conversation
… real API Three corrections to docs/reference/'Mongo Pipeline Builder.md', all verified against the query-builder source: - group() callbacks receive only the field accessor; acc is a module import from @prisma-next/mongo-query-builder, not a callback parameter. - Updater callbacks must return an array of update operations (UpdaterResult is ReadonlyArray); the bare-op form shown previously throws at runtime. - findOneAndUpdate takes returnDocument: 'before' | 'after' (default 'after'); returnNewDocument is not a recognized option. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Nurul Sundarani <sundarani@prisma.io>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDocumentation for the Mongo pipeline builder was updated to reflect a revised accumulator import/usage pattern in grouping examples and a new requirement that updater callbacks return arrays of update operations, along with an option rename from ChangesMongo Pipeline Builder Documentation
Estimated code review effort: 1 (Trivial) | ~5 minutes Related PRs: None specified in provided context. Suggested labels: documentation Suggested reviewers: None specified in provided context. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
size-limit report 📦
|
@prisma-next/extension-author-tools
@prisma-next/mongo-runtime
@prisma-next/family-mongo
@prisma-next/sql-runtime
@prisma-next/family-sql
@prisma-next/extension-arktype-json
@prisma-next/middleware-cache
@prisma-next/mongo
@prisma-next/extension-paradedb
@prisma-next/extension-pgvector
@prisma-next/extension-postgis
@prisma-next/postgres
@prisma-next/sql-orm-client
@prisma-next/sqlite
@prisma-next/extension-supabase
@prisma-next/target-mongo
@prisma-next/adapter-mongo
@prisma-next/driver-mongo
@prisma-next/contract
@prisma-next/utils
@prisma-next/config
@prisma-next/errors
@prisma-next/framework-components
@prisma-next/operations
@prisma-next/ts-render
@prisma-next/contract-authoring
@prisma-next/ids
@prisma-next/psl-parser
@prisma-next/psl-printer
@prisma-next/cli
@prisma-next/cli-telemetry
@prisma-next/config-loader
@prisma-next/emitter
@prisma-next/language-server
@prisma-next/migration-tools
prisma-next
@prisma-next/vite-plugin-contract-emit
@prisma-next/mongo-codec
@prisma-next/mongo-contract
@prisma-next/mongo-value
@prisma-next/mongo-contract-psl
@prisma-next/mongo-contract-ts
@prisma-next/mongo-emitter
@prisma-next/mongo-schema-ir
@prisma-next/mongo-query-ast
@prisma-next/mongo-orm
@prisma-next/mongo-query-builder
@prisma-next/mongo-lowering
@prisma-next/mongo-wire
@prisma-next/sql-contract
@prisma-next/sql-errors
@prisma-next/sql-operations
@prisma-next/sql-schema-ir
@prisma-next/sql-contract-psl
@prisma-next/sql-contract-ts
@prisma-next/sql-contract-emitter
@prisma-next/sql-lane-query-builder
@prisma-next/sql-relational-core
@prisma-next/sql-builder
@prisma-next/target-postgres
@prisma-next/target-sqlite
@prisma-next/adapter-postgres
@prisma-next/adapter-sqlite
@prisma-next/driver-postgres
@prisma-next/driver-sqlite
commit: |
Linked issue
n/a — small change (doc corrections only). The same docs-validation pass also surfaced three product bugs, filed separately: #925, #926, #927.
Summary
Three examples in
docs/reference/Mongo Pipeline Builder.mddo not match the real query-builder API, so copying them fails at compile or run time. This PR corrects them:group()callbacks receive only the field accessor (accis a module import, and the doc's own later sections already say so), updater callbacks must return an array of update operations (UpdaterResultisReadonlyArray<…>; the bare-op form throwsUnreachable: items.length > 0 but first is undefined), andfindOneAndUpdatetakesreturnDocument: 'before' | 'after'(default'after') —returnNewDocumentis not a recognized option.All corrections are verified against the source (
packages/2-mongo-family/5-query-builders/query-builder/src/builder.ts,update-ops.ts,exports/index.ts) and empirically via executable doc-snippet specs run against mongodb-memory-server.Testing performed
group(fn: (fields) => Spec)(builder.ts),UpdaterResult = ReadonlyArray<TypedUpdateOp> | ReadonlyArray<MongoUpdatePipelineStage>(update-ops.ts:189),findOneAndUpdate(updaterFn, { upsert?, returnDocument? })withreturnDocument ?? 'after'(builder.ts:759-774).Skill update
n/a — the affected examples live only in
docs/reference/Mongo Pipeline Builder.md; no skill underpackages/0-shared/skills/documents these call shapes (checked forreturnNewDocument,(f, acc), and the write-method examples).Checklist
git commit -s) per the DCO.contrib-pr); conventional-commit form used instead.Notes for the reviewer
The doc's prose around find-and-modify was also adjusted to explain the
returnDocumentdefault, and a one-line note about array-shaped updater returns was added above the write examples, since the bare-op form typechecks in the reader's head but is a compile error in practice. Product bugs found in the same validation pass (ObjectId equality inmatch(), raw codec-id inference, rawfindOneAndUpdateoptions) are deliberately not touched here — they're tracked in #925/#926/#927.🤖 Generated with Claude Code
Summary by CodeRabbit