Lots of MongoDB update functions?


I’m writing an app which will have 100-200 fields per mongoDB document. Using the Validated Methods package at the moment, and I’m wondering whether I should write a single updating validated method for every possible field in the database?

Sometimes I have to update several fields at once, is there any significant performance concern in calling 10-15 meteor methods, and therefore should I write another method which updates all of those fields in the same method, and call that one instead?


Here’s what you want.

If you have 100+ fields. Try nesting them in sub-objects. Use SimpleSchema to have a propper structure.

You can expose a single method that takes in an _id, and the data that you want to “merge”.
You could find that _id, and do a “deep merge” with your actual data, and do a $set.

It really really depends on what you have going on there :smiley:
Try separating your concerns, but having 15 methods for updating a single object just depending on the fields is a little bit “eyebrow raising”