From 1fc532f6369d7decdc384a1d350ed1aeee6475e6 Mon Sep 17 00:00:00 2001 From: Vadym Samoilenko Date: Fri, 15 May 2026 16:32:18 +0100 Subject: [PATCH] vault backup: 2026-05-15 16:32:18 --- 99 Daily/2026-05-15.md | 1 + raw/{ => _processed}/queries__overview.md | 0 wiki/payloadcms/_index.md | 2 +- wiki/payloadcms/queries.md | 28 +++++++++++++++++++---- 4 files changed, 26 insertions(+), 5 deletions(-) rename raw/{ => _processed}/queries__overview.md (100%) diff --git a/99 Daily/2026-05-15.md b/99 Daily/2026-05-15.md index fcf9d2b..79d772b 100644 --- a/99 Daily/2026-05-15.md +++ b/99 Daily/2026-05-15.md @@ -84,3 +84,4 @@ tags: [daily] - 16:15 — session ended | `ai_leed` - 16:29 (1min) — session ended | `ai_leed` - 16:30 — session ended | `ai_leed` +- 16:31 — session ended | `ai_leed` diff --git a/raw/queries__overview.md b/raw/_processed/queries__overview.md similarity index 100% rename from raw/queries__overview.md rename to raw/_processed/queries__overview.md diff --git a/wiki/payloadcms/_index.md b/wiki/payloadcms/_index.md index fcce932..57d9285 100644 --- a/wiki/payloadcms/_index.md +++ b/wiki/payloadcms/_index.md @@ -24,7 +24,7 @@ | [[wiki/payloadcms/local-api\|Local API]] | Direct DB access via `payload.*` — CRUD, auth ops, globals, server functions, access control, outside Next.js | raw/local-api__*.md | 2026-05-15 | | [[wiki/payloadcms/local-api-outside-nextjs\|Local API — Outside Next.js]] | Standalone scripts with `getPayload`, `payload run` CLI, ESM requirement, tsx/swc/bun transpilation options | raw/local-api__outside-nextjs.md | 2026-05-15 | | [[wiki/payloadcms/rest-api\|REST API]] | Auto-generated HTTP endpoints, all query params, auth routes, SDK, custom endpoints, method override | raw/rest-api__overview.md | 2026-05-15 | -| [[wiki/payloadcms/queries\|Queries]] | Where operators, and/or logic, depth, pagination, sort, select/populate — full reference with examples | raw/queries__*.md | 2026-05-15 | +| [[wiki/payloadcms/queries\|Queries]] | Where operators (15 total), and/or nesting, dot notation, depth, pagination, sort, select/populate — full reference with perf checklist | raw/queries__overview.md, raw/queries__*.md | 2026-05-15 | | [[wiki/payloadcms/ecommerce\|Ecommerce]] | Plugin setup, Stripe payments, cart API, frontend hooks, multi-currency, piecemeal collections | raw/ecommerce__*.md | 2026-05-15 | | [[wiki/payloadcms/ecommerce-advanced\|Ecommerce — Advanced / Piecemeal Collections API]] | All 8 `create*Collection` factory functions with full prop/access tables + TS types (CurrenciesConfig, Currency, CountryType, InventoryConfig) | raw/ecommerce__advanced.md | 2026-05-15 | | [[wiki/payloadcms/ecommerce-frontend\|Ecommerce — Frontend React Utilities]] | EcommerceProvider, useCart, usePayments (2-step checkout), useAddresses, useCurrency, useEcommerceConfig, useEcommerce; session management (onLogin, onLogout, mergeCart) | raw/ecommerce__frontend.md | 2026-05-15 | diff --git a/wiki/payloadcms/queries.md b/wiki/payloadcms/queries.md index 43fc88c..aeef9a9 100644 --- a/wiki/payloadcms/queries.md +++ b/wiki/payloadcms/queries.md @@ -1,17 +1,32 @@ --- -tags: [payloadcms, tech-patterns] -topic: payloadcms +title: "Payload CMS — Queries Overview" +aliases: [payload-queries, payload-where, payload-filtering] +tags: [payloadcms, queries, filtering, local-api, rest-api, graphql] sources: + - raw/queries__overview.md - https://payloadcms.com/docs/queries/overview - https://payloadcms.com/docs/queries/depth - https://payloadcms.com/docs/queries/pagination - https://payloadcms.com/docs/queries/select - https://payloadcms.com/docs/queries/sort created: 2026-05-15 +updated: 2026-05-15 --- # PayloadCMS — Queries +## Key Takeaways + +- **One language, three APIs** — same `Where` object works in [[wiki/payloadcms/local-api|Local API]], [[wiki/payloadcms/rest-api|REST API]], and [[wiki/payloadcms/graphql-overview|GraphQL]]; only the wrapper syntax differs +- **15 operators** cover equality, comparison, text search, list membership, existence, and geospatial queries +- **`and`/`or` nesting** can be arbitrarily deep for complex filter logic +- **Dot notation** (`'artists.featured'`) accesses nested and relationship fields without joins +- **REST queries use `qs-esm`** — complex `Where` objects stringify cleanly; avoid hand-crafting query strings +- **`all` operator is MongoDB-only** — do not use with Postgres/SQLite adapters +- **Performance stack:** `index: true` + `depth: 0` + `limit: 1` + `pagination: false` + `select` combined is the fastest pattern for unique-field lookups +- **`depth` is ignored in GraphQL** — shape your GraphQL query fields instead +- Add `index: true` to any field queried or sorted frequently — biggest single perf win + ## Overview Payload's querying language is uniform across all three APIs (Local, REST, GraphQL). You write the same logic; only the syntax wrapper differs. @@ -321,5 +336,10 @@ Return `undefined` to leave caller's select unchanged. This runs before the read ## Related -- [[wiki/payloadcms/local-api|Local API]] -- [[wiki/payloadcms/rest-api|REST API]] +- [[wiki/payloadcms/local-api|Local API]] — direct DB access via `payload.find()` +- [[wiki/payloadcms/rest-api|REST API]] — HTTP endpoints with query string syntax +- [[wiki/payloadcms/graphql-overview|GraphQL API]] — `where` argument in queries/mutations +- [[wiki/payloadcms/queries-depth|Queries — Depth]] — relationship population control +- [[wiki/payloadcms/database-indexes|Database Indexes]] — `index: true` field config +- [[wiki/payloadcms/fields-point|Point Field]] — `near`/`within`/`intersects` operators +- [[wiki/payloadcms/performance-overview|Performance Optimization]] — full perf checklist