anchor.diff:  go(_, [], _) ->
       {ok, []};
   go(DbName, AllDocs0, Opts) ->
  -    AllDocs1 = before_doc_update(DbName, AllDocs0),
  +    AllDocs1 = before_doc_update(DbName, AllDocs0, Opts),
       AllDocs = tag_docs(AllDocs1),
       validate_atomic_update(DbName, AllDocs, lists:member(all_or_nothing, Opts)),
       Options = lists:delete(all_or_nothing, Opts),
  
positive.code: 
  path_ends_with(Path, Suffix) ->
      Suffix == lists:last(binary:split(mem3:dbname(Path), <<"/">>, [global])).
  
  tag_docs([]) ->
      [];
  
negative.code: handle_message({bad_request, Msg}, _, _) ->
      throw({bad_request, Msg}).
  
  before_doc_update(DbName, Docs, Opts) ->
      Db = fake_db(Opts),
      case {is_replicator_db(DbName), is_users_db(DbName)} of
          {true, _} ->
              [couch_replicator_manager:before_doc_update(Doc, Db) || Doc <- Docs];
          {_, true} ->
              [couch_users_db:before_doc_update(Doc, Db) || Doc <- Docs];
          _ ->
              Docs
      end.
  