Currently, this is possible only via native Erlang query server:

fun(NewDoc, OldDoc, {UserCtx}, SecObj) ->
  DbName = couch_util:get_value(<<"db">>, UserCtx),
  {ok, Db} = couch_db:open_int(DbName, [{user_ctx, UserCtx}]),
  {ok, Info} = couch_db:get_db_info(Db),
  DiskSize = couch_util:get_value(disk_size, Info),
  case DiskSize < 100000 of  %% ~100KB
    true ->
      ok;
    false ->
      throw({[{<<"forbidden">>, <<"quota limit reached">>}]})
  end,
  1
end.



--
,,,^..^,,,


On Sat, Nov 9, 2013 at 7:56 AM, first-l...@yandex.ru
<first-l...@yandex.ru> wrote:
> Hello.
>
> Can I get information about the database as a function of
> validate_doc_update? For example, to find out the size of the database or
> the number of documents.
>
> Example:
> function(newDoc, oldDoc, userCtx) {
>  if ( thisDb.disk_size > 1000 ) throw({forbidden : 'you have exceeded the
> limit'});
> }
>
> It is possible?
>
> Thanks.

Reply via email to