-
-
Notifications
You must be signed in to change notification settings - Fork 722
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
This package is made to process data from a "one file = one entry" principle:
content/
articles/
article-1.json
article-2.json
home.json
While this structure makes sense for articles and/or pages where each entry contains a lot of data, this is not always the case.
Let's take for example a huge list of employees where each entry contains only a few keys. The management of this data is easier in a single JSON file, in the form of an object table:
// content/employees.json
[
{
"name" : "Philippe Etchebest",
"picture" : "philippe-etchebest.jpg",
"position" : "Chef"
}, {
//...
}
]Describe the solution you'd like
I would expect that nuxt/content process this array as a data source, allowing me to use queries on it. Fore instance:
const employees = $content("employees").where({ position: { $ne: "Chef" } }).fetch();Giving us the opportunity to use a JSON mono-file, containing an array of objects where "one object = one entry".
Describe alternatives you've considered
The alternative would be:
- Use JS module import instead, and native Array methods (find, filter, ...)
- Change our data structure to fit the current
nuxt/contentphilosophy
Additional context
delphinu, PierreLeBlond, gautierrollin, arsenipachkovski, yuccai and 3 more
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request