I'm trying to target a object in an array, then insert data in that same object, beside the matched key/value pair. Here is an example:
profile = [
{
data: 'value',
array: [
'one',
'three'
]
}
]
var i = 0;
var selector = 0;
_.each(profile, function(elem) {
if (elem.data === 'value') {
selector = i;
}
i++
}
profile[selector].array.push('two');
This is a workaround to add to an array of objects/arrays, but I'm trying to find a way to do this with Meteor MongoDB. Is there a selector that will enable me to target the appropriate array (with matching key/value pair) then target the "array" beside it and push something to it?