custom ids are returned empy array on create #3049
-
DescriptionI am using FeathersJS with a Knex MySQL database, and I am trying to implement UUID as the primary key for my table. However, when I create a new record, the response from the create method is an empty array ([]) instead of the newly created data object. Steps to ReproduceCreate a FeathersJS service that uses Knex MySQL as the database. Expected ResultThe response from the create method should be the newly created data object, including the newly generated UUID. Actual ResultThe response from the create method is an empty array ([]), and the newly created data object is not returned. Additional InformationI have tried modifying the create method to explicitly retrieve the newly created record from the database and return it in the response, but I encountered the error "The values in the where clause must not be an object or an array". I also tried casting the id value to a string before using it in the where clause, but I encountered the error "ER_NO_TABLES_USED: No tables used". EnvironmentFeathersJS version: 5.0.0-pre.37 QuestionsCan you provide a solution for this issue, or suggest a workaround? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This has been addressed and then reverted in #2934 because it breaks functionality in other databases. I found the most reliable solution is to generate the UUID (or any other id format) in the We could add the id returning behaviour as an option to avoid the whack-a-mole we've been doing with the various fixes around this. |
Beta Was this translation helpful? Give feedback.
This has been addressed and then reverted in #2934 because it breaks functionality in other databases. I found the most reliable solution is to generate the UUID (or any other id format) in the
data
resolver before it is created in the database.We could add the id returning behaviour as an option to avoid the whack-a-mole we've been doing with the various fixes around this.