Add element to grandchild collection in MongoDb

I have a MongoDb document like this

"schools":
[
    "name" : "University",
    "classes" :
    [
        {
            "name":"Chem",
            "teachers":
                [
                    "Joe",
                    "Bill"
                ]
        },
        {
            "name":"Math",
            "teachers":
                [
                    "Julie",
                    "Phil"
                ]
        },
    ],
    // More schools/classes/teachers here
]

How do I add a new teacher to the Math class?

(I'm writing this in node.js)

For the specific case you listed, you can do it like this:

myDocument.schools[0].classes[1].teachers.push("A new teacher");
myDocument.save();

For general cases (eg, add teacher to a class named "xyz"), you'd have to loop through the appropriate array(s) to find the item you're looking for.