anchor.diff:      % the normal case
       #view_acc{
           db = Db,
  +        doc_info = DocInfo,
           limit = Limit,
           include_docs = IncludeDocs
       } = Acc,
  
positive.code: 
  changes_enumerator(DocInfo, {Db, _Seq, Args}) ->
      #changes_args{include_docs=IncludeDocs, filter=Acc} = Args,
      #doc_info{id=Id, high_seq=Seq, revs=[#rev_info{deleted=Del,rev=Rev}|_]}
          = DocInfo,
      case [X || X <- couch_changes:filter(DocInfo, Acc), X /= null] of
      [] ->
          {ok, {Db, Seq, Args}};
      Results ->
          ChangesRow = changes_row(Db, Seq, Id, Results, Rev, Del, IncludeDocs),
          Go = rexi:sync_reply(ChangesRow),
          {Go, {Db, Seq, Args}}
      end.
  
  changes_row(Db, Seq, Id, Results, Rev, Del, true) ->
      #change{key=Seq, id=Id, value=Results, doc=doc_member(Db, Id, Rev), deleted=Del};
  changes_row(_, Seq, Id, Results, _, true, false) ->
      #change{key=Seq, id=Id, value=Results, deleted=true};
  changes_row(_, Seq, Id, Results, _, false, false) ->
      #change{key=Seq, id=Id, value=Results}.
  
  doc_member(Shard, Id, Rev) ->
      case couch_db:open_doc_revs(Shard, Id, [Rev], []) of
      {ok, [{ok,Doc}]} ->
          couch_doc:to_json_obj(Doc, []);
      Error ->
          Error
  
negative.code:         % we'll embed this at a higher level b/c the doc may be non-local
          Doc = undefined;
      IncludeDocs ->
          IdOrInfo = if DocInfo =/= nil -> DocInfo; true -> Id end,
          case couch_db:open_doc(Db, IdOrInfo, []) of
          {not_found, deleted} ->
              Doc = null;
          {not_found, missing} ->
  