-
-
Notifications
You must be signed in to change notification settings - Fork 740
Closed
Description
Environment
| Operating system | Windows 10.0.26200 |
| CPU | 12th Gen Intel(R) Core(TM) i7-12700H (20 cores) |
| Node.js version | v22.16.0 |
| nuxt/cli version | 3.31.3 |
| Package manager | [email protected] |
| Nuxt version | 4.2.1 |
| Nitro version | 2.12.9 |
| Builder | [email protected] |
| Config | app, compatibilityDate, content, css, devtools, eslint, fonts, icon, image, imports, modules, nitro, routeRules, ssr, studio, ui |
| Modules | @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], [email protected] |
Version
v3.8.2
Reproduction
https://stackblitz.com/edit/github-tjwto6ph?file=app%2Fpages%2Findex.vue
Description
Data querying following tutorial from Content Docs is not correct with using stem.
If collection is defined as follows:
authors: defineCollection({
type: 'data',
source: 'authors/**.json',
schema: z.object({
name: z.string(),
avatar: z.string(),
url: z.string(),
}),
}),And files farnabaz.json and larbish.json exists in the directory /content/authors/, this method of querying could not be used:
const { data: author } = await useAsyncData('larbish', () => {
return queryCollection('authors')
.where('stem', '=', 'larbish') // here is the problem
.first()
})Because the stem is in fact authors/larbish.
I don't know if this is a bug and stem should be just the rest of path without the directory (e.g., /content/authors/farnabaz.json -> farnabaz, /content/authors/subfolder/farnabaz.json -> subfolder/farnabaz), or if the stem is meant to be same as path.
Either way, there is a bug in code or in the docs webpage.
Additional context
No response
Logs
Metadata
Metadata
Assignees
Labels
No labels