Skip to content

Conversation

@HADB
Copy link
Contributor

@HADB HADB commented Jan 22, 2025

πŸ”— Linked issue

#2927

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

After some investigation, I discovered that #2927 is caused by the following code in query.ts, where the value is wrapped in quotes. This prevents boolean results from being found.

condition = `"${String(field)}" ${operator} '${value}'`

In SQLite, boolean values are stored as 0 and 1. When searching with true or false, they are converted to 0 and 1, which works fine. However, when searching with 'true' or 'false', it fails.

The solution is to convert them to 0 and 1 before adding quotes.

This should work with both 0/1 and true/false in query condition.

Resolves #2927

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 22, 2025

npm i https://pkg.pr.new/@nuxt/content@3018

commit: de0820f

@HADB HADB changed the title docs: use = instead of == in where fix: convert boolean value to number in query condition Jan 22, 2025
Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks πŸ‘

@farnabaz farnabaz merged commit c11f90a into nuxt:main Jan 22, 2025
3 checks passed
This was referenced Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zod not working correcly in V3 schema

2 participants