anchor.diff:      {lists:flatten(io_lib:format("~p -> ~p", [From, To])), [
           {"Target DB has proper number of docs",
           ?_assertEqual(1, proplists:get_value(doc_count, TargetDbInfo))},
  +        {"Target DB doesn't have deleted docs",
  +        ?_assertEqual(0, proplists:get_value(doc_del_count, TargetDbInfo))},
  +        {"All the docs filtered as expected",
  +        ?_assert(lists:all(fun(Valid) -> Valid end, AllReplies))}
  +    ]}.
  +
  +should_succeed_with_query({From, To}, {_Ctx, {Source, Target}}) ->
  +    RepObject = {[
  +        {<<"source">>, db_url(From, Source)},
  +        {<<"target">>, db_url(To, Target)},
  +        {<<"filter">>, <<"filter_ddoc/queryfilter">>},
  +        {<<"query_params">>, {[
  +            {<<"starts">>, <<"a">>}
  +        ]}}
  +    ]},
  +    {ok, _} = couch_replicator:replicate(RepObject, ?ADMIN_USER),
  +    FilterFun = fun(_DocId, {Props}) ->
  +        case couch_util:get_value(<<"class">>, Props) of
  +            <<"a", _/binary>> -> true;
  +            _ -> false
  +        end
  +    end,
  +    {ok, TargetDbInfo, AllReplies} = compare_dbs(Source, Target, FilterFun),
  +    {lists:flatten(io_lib:format("~p -> ~p", [From, To])), [
  +        {"Target DB has proper number of docs",
  +        ?_assertEqual(2, proplists:get_value(doc_count, TargetDbInfo))},
           {"Target DB doesn't have deleted docs",
           ?_assertEqual(0, proplists:get_value(doc_del_count, TargetDbInfo))},
           {"All the docs filtered as expected",
  
positive.code:     {<<"filters">>, {[
          {<<"testfilter">>, <<"
              function(doc, req){if (doc.class == 'mammal') return true;}
          ">>}
      ]}}
  ]}).
  
negative.code:         {<<"value">>, 3}
  
      ]}),
      Doc4 = couch_doc:from_json_obj({[
          {<<"_id">>, <<"doc4">>},
          {<<"class">>, <<"arthropods">>},
          {<<"value">>, 2}
  
      ]}),
      {ok, _} = couch_db:update_docs(Db, [DDoc, Doc1, Doc2, Doc3, Doc4]),
      couch_db:ensure_full_commit(Db),
      couch_db:close(Db).
  
  