Erlang & CouchDB: how to bulk delete docs using couchbeam

I spent about an hour on this, so I post the solution:

	% get site's stat docs
	{ok, ViewResults} = couchbeam_view:fetch(Db_pid,
									  {"app", "get-stat-by-site-url"},
								 	  [{key, list_to_binary(Site)}]),
	Stats = lists:map(fun({Doc})->
                        {Value} = proplists:get_value(<<"value">>, Doc),
						{[{<<"_id">>, proplists:get_value(<<"_id">>, Value)},
                          {<<"_rev">>, proplists:get_value(<<"_rev">>, Value)}
						 ]}
                 end, ViewResults),
	% delete stats
	couchbeam:delete_docs(Db_pid, Stats),