anchor.diff:  
   
   
  -changes_row(Results, DocInfo, #changes_acc{filter={fast_view,_,_,_}}=Acc) ->
  -    format_doc_info_change(Results, DocInfo, Acc);
  -changes_row(Results, KV, #changes_acc{view=#mrview{}}=Acc) ->
  -    {{Seq, Key}, {Id, Value, Rev}} = KV,
  -    {[{<<"seq">>, Seq}, {<<"id">>, Id}, {<<"key">>, Key}, {<<"value">>, Value}, {<<"changes">>, Results}] ++ maybe_get_changes_doc({Id, Rev}, Acc)};
  -changes_row(Results, #doc_info{}=DocInfo, Acc) ->
  -    format_doc_info_change(Results, DocInfo, Acc).
  -
  -format_doc_info_change(Results, #doc_info{}=DocInfo, Acc) ->
  +view_changes_row(Results, KVs, Acc) ->
  +    {Add, Remove} = lists:foldl(fun(Row, {AddAcc, RemAcc}) ->
  +        {{_Seq, Key}, {_Id, Value, _Rev}} = Row,
  +        case Value of
  +            removed ->
  +                {AddAcc, [Key|RemAcc]};
  +            {dups, DupValues} ->
  +                AddAcc1 = lists:foldl(fun(DupValue, AddAcc0) ->
  +                    [[Key, DupValue]|AddAcc0]
  +                end, AddAcc, DupValues),
  +                {AddAcc1, RemAcc};
  +            _ ->
  +                {[[Key, Value]|AddAcc], RemAcc}
  +        end
  +    end, {[], []}, KVs),
  +
  +    % Seq, Id, and Rev should be the same for all KVs, since we're aggregating
  +    % by seq.
  +    [{{Seq, _Key}, {Id, _Value, Rev}}|_] = KVs,
  +
  +    {[
  +        {<<"seq">>, Seq}, {<<"id">>, Id}, {<<"add">>, Add},
  +        {<<"remove">>, Remove}, {<<"changes">>, Results}
  +    ] ++ maybe_get_changes_doc({Id, Rev}, Acc)}.
  +
  +
  +changes_row(Results, DocInfo, Acc) ->
       #doc_info{
           id = Id, high_seq = Seq, revs = [#rev_info{deleted = Del} | _]
       } = DocInfo,
  
positive.code:     doc_options,
      conflicts,
      timeout,
      timeout_fun
  }).
  
  handle_db_changes(Args, Req, Db) ->
  
negative.code:         filter = Filter,
          view = View
      } = Acc,
      DbEnumFun = fun changes_enumerator/2,
      case can_optimize(FirstRound, Filter) of
          {true, Fun} ->
              Fun(Db, StartSeq, Dir, DbEnumFun, Acc, Filter);
          _ ->
              case {View, Filter}  of
                  {#mrview{}, {fast_view, _, _, _}} ->
                      couch_mrview:view_changes_since(View, StartSeq, DbEnumFun, [{dir, Dir}], Acc);
                  {undefined, _} ->
                      couch_db:changes_since(Db, StartSeq, DbEnumFun, [{dir, Dir}], Acc);
                  {#mrview{}, _} ->
                      ViewEnumFun = fun view_changes_enumerator/2,
                      {Go, Acc0} = couch_mrview:view_changes_since(View, StartSeq, ViewEnumFun, [{dir, Dir}], Acc),
                      case Acc0 of
                          #changes_acc{aggregation_results=[]} ->
                              {Go, Acc0};
                          _ ->
                              #changes_acc{
                                  aggregation_results = AggResults,
                                  aggregation_kvs = AggKVs,
                                  user_acc = UserAcc,
                                  callback = Callback,
                                  resp_type = ResponseType,
                                  prepend = Prepend
                              } = Acc0,
                              ChangesRow = view_changes_row(AggResults, AggKVs, Acc0),
                              UserAcc0 = Callback({change, ChangesRow, Prepend}, ResponseType, UserAcc),
                              reset_heartbeat(),
                              {Go, Acc0#changes_acc{user_acc=UserAcc0}}
                      end
              end
      end.
  
  