vault backup: 2026-05-15 16:32:18
This commit is contained in:
parent
fea3130985
commit
1fc532f636
4 changed files with 26 additions and 5 deletions
|
|
@ -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`
|
||||
|
|
|
|||
|
|
@ -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 |
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue