With this function, instead of using several times the same function to add some fields to a document, we can use set_values.
Instead of using couchbeam_doc:set_value/3
Doc = {[{<<"content">>, <<"this is a funny doc">>}]}.
Doc1 = couchbeam_doc:set_value(<<"active">>, true, Doc).
Doc2 = couchbeam_doc:set_value(<<"type">>, <<"user">>, Doc1).
You can use couchbeam_doc:set_values/2
Example:
1> Doc = {[{<<"content">>, <<"this is a funny doc">>}]}.
{[{<<"content">>,<<"this is a funny doc">>}]}
2> couchbeam_doc:set_values([{<<"active">>, true}], Doc).
{[{<<"content">>,<<"this is a funny doc">>},{<<"active">>,true}]}
3> couchbeam_doc:set_values([{<<"active">>, true}], Doc).
{[{<<"content">>,<<"this is a funny doc">>},{<<"active">>,true}]}
4> couchbeam_doc:set_values([{<<"active">>, true}, {<<"type">>, <<"user">>}], Doc).
{[{<<"content">>,<<"this is a funny doc">>},
{<<"active">>,true},
{<<"type">>,<<"user">>}]}
With this function, instead of using several times the same function to add some fields to a document, we can use set_values.
Instead of using couchbeam_doc:set_value/3
You can use couchbeam_doc:set_values/2 Example: