benoitc / couchbeam

Apache CouchDB client in Erlang
Other
242 stars 113 forks source link

Adding a function to remove a field of a doc #5

Closed zotop closed 14 years ago

zotop commented 14 years ago

Now that we can create fields, set their values, get their values. It would also be nice to be able to delete them if wanted.

Thanks.

benoitc commented 14 years ago

added in latest head :

1> couchbeam:start().
** Found 0 name clashes in code paths 
ok
2> couchbeam_server:start_connection().
<0.61.0>
3> Doc = {[{<<"test">>, <<"essai">>}]}.
{[{<<"test">>,<<"essai">>}]}
4> couchbeam_server:open_db(default, {testdb, "testdb"}).
<0.68.0>
5> Doc1 = couchbeam_db:save_doc(testdb, Doc).
{[{<<"test">>,<<"essai">>},
  {<<"_id">>,<<"f056c6a2094ff332dfde570c7d08b0f9">>},
  {<<"_rev">>,<<"1-6a4595a245c383885767cb266adb0d6d">>}]}
6> Doc2 = couchbeam_doc:delete_value(<<"test">>, Doc1).
{[{<<"_id">>,<<"f056c6a2094ff332dfde570c7d08b0f9">>},
  {<<"_rev">>,<<"1-6a4595a245c383885767cb266adb0d6d">>}]}
zotop commented 14 years ago

Thank you. :)