How to use meta.category or meta.date in .where() query? #3431
Unanswered
ivanradojevic-web-dev
asked this question in
Q&A
Replies: 1 comment
-
|
In v3, fields such as Define the fields in import { defineCollection, defineContentConfig, z } from "@nuxt/content"
export default defineContentConfig({
collections: {
docs: defineCollection({
type: "page",
source: "**/*.md",
schema: z.object({
date: z.string(),
category: z.string()
})
})
}
})Then this should work as a normal query: const { data } = await useAsyncData(route.path, () => {
return queryCollection("docs")
.where("date", "<", "2024-04-04")
.where("category", "=", "news")
.all()
})A couple of gotchas:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How can I use category or date in .where() queries?!?
{
"date": "2024-01-10",
"category": "economy"
}
Beta Was this translation helpful? Give feedback.
All reactions