anchor.diff:          updated ->
               {ok, Db2} = couch_db:open(DbName, [{user_ctx, UserCtx}]),
               keep_sending_changes(Req, Resp, Db2, EndSeq, Prepend2, Timeout,
  -                TimeoutFun, ResponseType, Filter, End);
  +                TimeoutFun, ResponseType, NewLimit, Filter, End);
           stop ->
               end_sending_changes(Resp, EndSeq, ResponseType)
           end
       end.
   
  -changes_enumerator(DocInfos, {Db, _, _, FilterFun, Resp, "continuous", IncludeDocs}) ->
  +changes_enumerator(DocInfos, {Db, _, _, FilterFun, Resp, "continuous", Limit, IncludeDocs}) ->
       [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{deleted=Del,rev=Rev}|_]}|_] = DocInfos,
       Results0 = [FilterFun(DocInfo) || DocInfo <- DocInfos],
       Results = [Result || Result <- Results0, Result /= null],
  +    Go = if Limit =< 1 -> stop; true -> ok end,
       case Results of
       [] ->
  -        {ok, {Db, Seq, nil, FilterFun, Resp, "continuous", IncludeDocs}};
  +        {Go, {Db, Seq, nil, FilterFun, Resp, "continuous", Limit, IncludeDocs}};
       _ ->
           send_chunk(Resp, [?JSON_ENCODE(changes_row(Db, Seq, Id, Del, Results, Rev, IncludeDocs))
               |"\n"]),
  -        {ok, {Db, Seq, nil, FilterFun, Resp, "continuous", IncludeDocs}}
  +        {Go, {Db, Seq, nil, FilterFun, Resp, "continuous",  Limit-1, IncludeDocs}}
       end;
  -changes_enumerator(DocInfos, {Db, _, Prepend, FilterFun, Resp, _, IncludeDocs}) ->
  +changes_enumerator(DocInfos, {Db, _, Prepend, FilterFun, Resp, _, Limit, IncludeDocs}) ->
       [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{deleted=Del,rev=Rev}|_]}|_] = DocInfos,
       Results0 = [FilterFun(DocInfo) || DocInfo <- DocInfos],
       Results = [Result || Result <- Results0, Result /= null],
  +    Go = if Limit =< 1 -> stop; true -> ok end,
       case Results of
       [] ->
  -        {ok, {Db, Seq, Prepend, FilterFun, Resp, nil, IncludeDocs}};
  +        {Go, {Db, Seq, Prepend, FilterFun, Resp, nil, Limit, IncludeDocs}};
       _ ->
           send_chunk(Resp, [Prepend, ?JSON_ENCODE(
               changes_row(Db, Seq, Id, Del, Results, Rev, IncludeDocs))]),
  -        {ok, {Db, Seq, <<",\n">>, FilterFun, Resp, nil, IncludeDocs}}
  +        {Go, {Db, Seq, <<",\n">>, FilterFun, Resp, nil, Limit-1, IncludeDocs}}
       end.
   
   changes_row(Db, Seq, Id, Del, Results, Rev, true) ->
  
positive.code:                             {httpd, clients_requesting_changes}),
          try
              keep_sending_changes(Req, Resp, Db, StartSeq, <<"">>, Timeout,
                  TimeoutFun, ResponseType, FilterFun, EndFilterFun)
          after
              couch_db_update_notifier:stop(Notify),
              get_rest_db_updated() % clean out any remaining update messages
  
negative.code:             {rev, Seq};
          _Bad -> throw({bad_request, "descending must be true or false"})
      end,
      Limit = list_to_integer(couch_httpd:qs_value(Req, "limit", "1000000000000000")),
      ResponseType = couch_httpd:qs_value(Req, "feed", "normal"),
      if ResponseType == "continuous" orelse ResponseType == "longpoll" ->
          {ok, Resp} = start_json_response(Req, 200),
  