Here’s our current use case and let me know how you’d handle it:
We use a (reactive) AutoForm form where a user can be assigned to an organization based on a certain criteria.
allowedValues() {
// we don't want to show ourselves and no other satellite pharmacies.
const query = { isSatelliteOf: { $exists: false } }
if (Meteor.isClient && getCurrentlyEditedInstitutionId())
query._id = { $ne: getCurrentlyEditedInstitutionId() }
return _.map(
Collections.Institutions.find(query, {
sort: { name: 1 },
fields: { _id: true }
}).fetch(),
"_id"
)
},
autoform: {
options() {
// we don't want to show ourselves and no other satellite pharmacies.
const query = { isSatelliteOf: { $exists: false } }
if (Meteor.isClient && getCurrentlyEditedInstitutionId())
query._id = { $ne: getCurrentlyEditedInstitutionId() }
return _.map(
Collections.Institutions.find(query, {
sort: { name: 1 },
fields: { _id: 1, name: 1 }
}).fetch(),
(institution) => {
return {
label: institution.name,
value: institution._id
}
}
)
}
}```