update_rep_doc(RepDbName, #doc{body = {RepDocBody}} = RepDoc, KVs) ->
        NewRepDocBody = lists:foldl(
            fun({K, undefined}, Body) ->
                    lists:keydelete(K, 1, Body);