I’m new to Meteor, a transplant from asp.net/sql. I have 2 questions about updating documents that contain a value that is set from a dropdown list whose values come from a Mongo collection (i.e. selecting US state or country on a user profile, etc.).
Ideally the solutions would use Blaze. I’m not quite ready for the whole React journey yet.
I googled to learn how to supply the “selected” Db value of the dropdown when the update form is loading, and found solutions like this: http://stackoverflow.com/questions/12124234/set-the-selected-item-in-a-select-list-based-on-template-value All solutions I found used static values in the dropdown list, though. So my first question is "how do I first fill a dropdown list’s values from the DB (i.e. a long list of countries) and then set its “selected” value… all in one shot when the update form is loading?
Most of the courses I’ve watched use separate templates for inserting vs. updating items. Whenever I built asp.net sites I always used a single page + code behind to handle inserts & updates of any given entity. If an Id was present in the query string, the 1 page was smart enough to load the existing form values and update the Db record when submitted. So my second question is “is it common to use a single template for both insert & update? If so… can anyone explain how, or provide links to the most commonly used best practices?”