-
Notifications
You must be signed in to change notification settings - Fork 67
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
Strange behavior when saving arrays with undefined values #644
Comments
@arggh Yep, indeed there is a bug. Thanks for noticing it. I've already fixed it and I will release a new version that fixes that. |
Fixed in Astronomy 2.5.0 |
I confirm the issue is now fixed, thanks! 👍 Btw, is this the "correct" way to define a field, which holds an Array of mixed nulls/undefineds and Strings? (with no validation yet for actually having only nulls/undefineds or Strings obviously)
|
Actually, there is no official way of doing it but if it works in your example then it's ok. In fact, an array is just an object so it should work properly. |
It works, it just looks a bit hacky so I was wondering if I had missed something in the docs. Maybe it could be a good idea to consider one or many of these solutions:
|
It is actually possible using unions
That would be the best solution. It would be similar to what we have in GraphQL. However, it would require entire redesign of the types system in Astronomy.
That actually might be the easiest one to do. Will think about implementing it. |
Unions dont support null types or optional keys afaik |
If I try to save my Astronomy document with an array like this
var a = [undefined, undefined, 'foobar', undefined]
, only the two last entries will be saved, resulting in['foobar', undefined]
.Reproduction:
https://github.com/arggh/astronomy-array-issue
How it works:
meteor
The text was updated successfully, but these errors were encountered: