don't forget... any loop that has a domino object in should have some recycling going on. You can crash a server if you don't.
This is from the Cheatshsheet and I think is still valid.
var doc:NotesDocument = collect.getFirstDocument();
var tmpDoc:NotesDocument
while (doc != null) {
tmpDoc = collect.getNextDocument();
// Insert Code here. Work with the “doc” object.
doc.recycle();
doc = tmpDoc;
}