Closed trevorgerhardt closed 5 months ago
I just tried out replacing DBProjection.exclude("request.scenario.modifications")
with DBProjection.include("bundleId", "scenarioId", "accessGroup"
to grab only the fields necessary to return the API response. This does work... almost. But the field regionalAnalysis.request.scenarioId
is different than regionalAnalysis.scenarioId
in the baseline scenario case (UUID versus the string "baseline" respectively). Fetching regionalAnalysis.request.scenarioId
means fetching regionalAnalysis.request
which runs into other problems with type fields and quickly becomes more trouble than it's worth. The other underlying problem to note here is that we have multiple ways to reference the baseline scenario as a string and mix them together in a single object.
This change adds a new helper method to pass a
fields
object toMongoMap#findByIdIfPermitted
and utilizes that to exclude modifications while looking up a regional analysis to generate ascenarioJsonUrl
.This will prevent
JacksonDBDecoder
errors from occurring if custom modifications are used in a worker version that do not also exist in the server. Sample errors like: