I am iterating through items in an object using the forEach method.
function scrapeRssFeedData(rssFeeds, cb){
rssFeeds.forEach(function(rssFeed){
rssFeed.property = 'value';
console.log(rssFeed.property);
console.log(rssFeed);
});
}
The value that is logged for rssFeed.property is, correctly 'value'.
However, when the rssFeed object itself is logged, the property is not visible.
The original rssFeeds object is built using a Mongoose model.
Why can I not see the property when logging the object? What can I do to fix it?
Update: Even this code is not working:
function scrapeRssFeedData(rssFeeds, cb){
rssFeeds[1]['property'] = 'value';
console.log(rssFeeds[1]);
}
The fact that this example doesn't work makes me believe almost certainly it's something to do with the object having been built by Mongoose. I want to be done with Mongoose though at this point of the program and want to start adding values to this object.