DLu/dominionstats — comment on commit 264834f0d211406bb537ae338ff9d9f2d22eaba0
File: goals.py line 356
By rrenaud:

I think this operation requires a full DB scan. Before it was searching on an indexed field, but you can't index the field if you don't know the 'object path' to the data you want, and if the player name is itself part of the 'object path', then you just can't index it ahead of time with mongo.

In general, I think it would be better to have a list of goals achieved per game,

Rather than your current structure of

GoalDoc
variable_player_name ->
variable_goal_name ->
player_name
reason

GoalDoc ->
_id
achievements ->
norm_name
goal_name
reason

The second representation also avoids namespace collision issues in the object, we can add first level meta data to the goal doc without working that we collide with a player name.