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