Doing advanced MongoDB updates in Lithium

I wanted to change a nested array value without first loading an entire MongoDB document in Lithium, but the documentation wasn’t clear. One of the developers on the #li3 IRC channel pointed me in the right direction.

Since the “atomic” option is defaulted to true, the $set is implied. The following example is with a model called “Lesson”:

$conditions = array('_id' =>  $_id); //conditions for document(s) to change
$data = array(('page_list.123.title') => $title); //nested value I want to change
Lesson::update($data,$conditions);

I hope that points you in the right direction. It’s like the native MongoCollection::update but with the first two parameters switched. You can also include a third parameter for options. Soon the update method will be patched to allow for MongoDB upserts.

How to install mod_pagespeed on Ubuntu

cd ~
# 64-bit
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_amd64.deb
#32-bit
# wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-beta_current_i386.deb
sudo dpkg -i mod-pagespeed*.deb
rm mod-pagespeed*.deb

Now configure the module:

nano /etc/apache2/mods-available/pagespeed.conf

You only need to worry about setting ModPagespeedDomain to your domain. Make sure you restart Apache:

sudo /etc/init.d/apache2 restart

Refresh your site a few times (yes, multiple times) and then look at the source to confirm it’s working.