Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need ability to query z.array() fields (e.g. tags) in the latest nuxt-content module (v3.alpha.8) #2960

Open
humblemodulo opened this issue Jan 10, 2025 · 2 comments
Labels
question Further information is requested v3

Comments

@humblemodulo
Copy link

Discussed in #2955

Originally posted by humblemodulo January 7, 2025
In the previous version of nuxt-content (v2) I would simply query tags like so:

  .where({ tags: { $contains: tagSlug } })

However there is no contains in v3, and the logic for IN seems to require the reverse operation. I've tried LIKE and that doesn't work either.

Definitely need to know the best way to find values in z.array() field types.

As it stands, I'm forced to retrieve all, then run JS .filter() on the results. Quite inefficient.

@farnabaz
Copy link
Member

Could you provide a simple reproduction?
The proper way to do this in sqlite is using json_each operator, which is not yet supported in Content query builder.
However, I believe we can achieve your goal with simpler solution with LIKE. If you provide a simple reproduction we can sort it out.

@UphkcRNqmafQWcSSSSSS
Copy link

 .where('tags', 'LIKE', `%${route.params.tag}%`)

@farnabaz farnabaz added question Further information is requested v3 labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested v3
Projects
None yet
Development

No branches or pull requests

3 participants