meteor-astronomy
meteor-astronomy copied to clipboard
Keys with dots
I'm getting this error:
Exception while invoking method 'login' Error: key profile.Leagues must not contain '.'
I think it's related to this recent change: https://github.com/meteor/meteor/issues/3786
OK, I think this is actually because I'm trying to add a nested field in a behavior, ideas for that? It looks like this right now:
fields: {
[behavior.options.keyStore]: {
type: [String],
optional: true,
default() {
return behavior.options.type === 'many' ? [] : '';
},
},
},
In my test case, I want the field to be profile.Leagues
The short answer will be to skip this. I can create a nested object like this:
const field = _.set({}, behavior.options.keyStore, {
type: behavior.options.type === 'many' ? [String] : String,
optional: true,
default() {
return behavior.options.type === 'many' ? [] : '';
},
})
...
fields: {
...field
},
But I get an error about reading prototype of undefined (something to do with types).
For setting nested fields you have doc.set method which works similarly to _.set but it has more features like ability to cast values, set default values etc. I can't help you with you problem as I have to little information. Moreover as I said in another issue, you should rather create module not behavior if you want to implement relations.