-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow NodeJS driver to apply automatic type conversion in query parameters #242
Comments
@josiahjohnston thanks for the report, I've just prepared a fix for it. You'll now be able to disable automated type checks for a specific field by setting a model schema rule for that field. Details available in validator doc. Hope to release it soon with the next version. |
Thank you so much for the prompt reply! |
Good point. We have existing users of the library who rely on the data type validation of express-cassandra. Hence adding a common configuration to disable the built in type checks all together should solve the problem without impacting other users of the library. Hope it'll solve the problem. |
Yes, that would be perfect. I tried to read the code to understand how to best accomplish it, but don't understand arch well enough to see the cleanest strategy. Makes sense that some users relied on that legacy behavior, and changes could break things for them. |
The NodeJS cassandra driver offers automatic & safe type conversion for prepared queries.
This is great for simpler code that doesn't have to convert strings to UUID types, dates, etc.
Ex:
Express Cassandra prepares all queries by default, so I expected this feature to be available.
But when I try to query with a string UUID instead of a UUID type, I get an error because string isn't a UUID type. The error is thrown by lib/utils/parser.js
get_db_value_expression()
. This forces me to write queries likemodels.datatypes.Uuid.fromString(id)
instead ofid
.Is there some way to bypass that type checking? If not, would you consider supporting that feature?
The text was updated successfully, but these errors were encountered: