-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue with .addToCollection() with string IDs #4591
Comments
@shobhitsinghal624 Thanks for posting, we'll take a look as soon as possible. For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here. |
HI @shobhitsinghal624, |
@shobhitsinghal624 @raqem Ok, so here's the problem: The default attributes configured in
In other words, Waterline doesn't know what UUID to use when creating junction records. I think there are two solutions:
I'll have a think about other ways we could improve this in core so that it just works™, but in the mean time I think that's your best bet. Thanks for bringing this up! |
Hey @shobhitsinghal624, Here is my code: config/models.js
And in both
Hope this helps! |
Thanks @raqem, @mikermcneil !
In my head (1) is a correct implementation, and we should solve (2). Maybe overload Closing the issue now. Thanks again! |
Hello I do not know if my problem is the same, i have tags coming my frontEnd formData as an array of IDs. In sails i attached the array to Articles collection using the addToCollection(). The response from sails is that |
|
Sails version: 1.1.0
Node version: v10.12.0
NPM version: 6.8.0
DB adapter name: N/A
DB adapter version: N/A
Operating system: macOS
Calling
.addToCollection()
whereid
is defined as astring
(specifically aUUID
) throws error. It works perfectly whenid
is anumber
.Steps to reproduce the issue provided below.
Create models with many-to-many association:
Set
id
to be aUUID
inconfig/models.js
Finally, make these calls in
sails console
to reproduce the issue. The.addToCollection()
call (last one) throws an error.The text was updated successfully, but these errors were encountered: