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
Id not returned on Model.create() #6052
Comments
Victory is mine and thank god for node inspector It looks like I would be happy to amend docs and create a pull request to give back to the cause, but I'm unsure if this is a bug or if this is how it should be. |
This is because you have the The id: {
type: 'integer',
primaryKey: true,
autoIncrement: true
} |
Also doc updates would be great! |
as you can see by my model has migrate safe. I'm working with an already existing dataset. So autoPk is false, but I'm not sure if autoPK false does anything since I have migrate = safe. I think where the sails/docs lack are mostly in the area of those of us dealing with existing DB's. Sails seems to work great out of the box, but there are many many hidden tweaks if your bringing in an existing DB. |
I posted in the groups, but I think its a bug assuming create is supposed to return the id (or full model) of the record created. When I try and perform a create on this model I don't not get an instance back. All that is returned are those fields that are sent with the create method. This means I am not getting the ID of the record created returned in the callback. My ID is autoIncrement in MySQL
I'm using
sails 0.10.0-rc8
sails-mysql 0.10.0-rc7
This is my model
This is a few console.log()s that I dropped into blueprints/create.js and to show the I/O
And then I also get this error as well at the end of the create action.
This is the result of all tested create actions. At the end of the cycle the record is entered into MySQL with the MySQL generated ID. I also tested this directly from a console> model.create() with the same results
The text was updated successfully, but these errors were encountered: