When validating the form, I’m using basic Javascript Array.push() to push all the errors into an array, then do Session.set('formErrors', errArray) and then the helper returns that.
Is this any better or worse than using a client-only collection?
formErrors = new Mongo.Collection(null);
and using insert operations to populate the collection? And once the form is corrected, the formErrors collection is emptied (but not destroyed).
I think both will work fine. Personally I prefer using a client-only collection so that I can run queries to get only some of the form errors if I need to.
Depending on what you do with the errors and how you display them, a collection would be preferable in cases you don’t want to invalidate the whole errors array. With a collection, only the change will be reflected whereas with a session tht contains an array, any change in the array will mean a change on the array as a whole.