1. Redesigned the user register flow.
  2. Tested the new register flow on a 75year old lady, 2 Gen Xers, 3 Millennials, and 2 Baby Boomers.
  3. Strongly considered rewriting all pug functionality in Vue — decided to do a future rewrite of the pug functionality (will lighten vanilla JS I had to write)
  4. Spent 2 hours debugging mongoDB not updating a document with a new item quantity or value. I was using a COMPUTEDKEY to target a specific item’s property (also controlled with a variable) within a user’s list.items (user.list.items). I originally had const computedKey = `list.items[${itemIndex}].${propertyToChange}`;. MongoDB doesn’t accept [index]. Instead, it uses array.index.property to target indexes within arrays.
const itemIndex = req.query.index;const newValue = parseFloat(req.query.updatedValue);const propertyToChange = req.query.property;const query = { _id: req.user.id };const computedKey = `list.items.${itemIndex}.${propertyToChange}`;const update = { $set: { [computedKey]: newValue } };const options = { new: true, context: 'query' };const user = await User.findOneAndUpdate(query, update, options);

--

--

Chris Johnson
The Squash and the Tomato

Full-stack Surgeon (Design, Vue, Node, mongoDB), knowledge seeker, world dominator, Harry Potter and anime addict, volleyball player, and unfiltered.