Move assignment-by-id to aggregation framework (much faster).