MongooseJS and the problem with adding new properties
My setup is easy. Node.js, ExpressJS, MongooseJS.
The Problem I was getting a list of objects from the MongoDB. Like this
// Find all items where owner in following array Thing.find() .where('owner').in(following) .populate('owner') .populate('comments.userId') .sort('-updatedOn') .limit(20) .exec(callback); In the callback I was assigning the results to res.locals.things for use in another middleware function.
In another middleware function I tried this
// Extend thing[i] with a new property called newProperty for var i=0; i < res.