Skip to content

Instantly share code, notes, and snippets.

@zkessin
Created July 27, 2017 10:33
Show Gist options
  • Save zkessin/6a7d2543e90f18162993392b0e79cbb5 to your computer and use it in GitHub Desktop.
Save zkessin/6a7d2543e90f18162993392b0e79cbb5 to your computer and use it in GitHub Desktop.
-module(neg_doccount).
-compile(export_all).
test() ->
{ok,_} = application:ensure_all_started(barrel),
barrel:create_database(#{<<"database_id">> => <<116, 101, 115, 116, 48, 49>>}),
barrel:post(<<116, 101, 115, 116, 48, 49>>,
#{<<99, 111, 110, 116, 101, 110, 116>>
=> <<0, 0, 0, 0, 0, 0, 0, 0>>,
<<105, 100>>
=> <<218, 164, 36, 239, 171, 143, 231, 142, 168, 203, 166,
100>>},
#{}),
barrel:delete(<<116, 101, 115, 116, 48, 49>>,
<<218, 164, 36, 239, 171, 143, 231, 142, 168, 203, 166, 100>>,
#{}),
barrel:post(<<116, 101, 115, 116, 48, 49>>,
#{<<99, 111, 110, 116, 101, 110, 116>>
=> <<0, 0, 0, 0, 0, 0, 0, 0>>,
<<105, 100>> => <<0, 0, 0, 0, 0, 0>>},
#{}),
barrel:delete(<<116, 101, 115, 116, 48, 49>>,
<<218, 164, 36, 239, 171, 143, 231, 142, 168, 203, 166, 100>>,
#{}),
barrel:delete(<<116, 101, 115, 116, 48, 49>>,
<<218, 164, 36, 239, 171, 143, 231, 142, 168, 203, 166, 100>>,
#{}),
barrel:delete(<<116, 101, 115, 116, 48, 49>>,
<<59, 205, 138, 60, 43, 242, 145, 168, 133, 108>>, #{}),
{ok, #{docs_count:=DC}} = barrel:database_infos(<<116, 101, 115, 116, 48, 49>>),
DC.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment