code: public static Update forEach(String field,
                                   UpdateQuery q,
                                   ForEachUpdate u) {
          Update x = new Update(false);
          ObjectNode fe = JsonNodeFactory.instance.objectNode();
          fe.set(field, q.toJson());
          fe.set("$update", u.toJson());
          ((ObjectNode) x.node).set("$foreach", fe);
          return x;
      }
docs: <pre>
  { $foreach : { field: { q }, $update: u } }
  </pre>