Luke, thank you for the answer! I did this, my code is:
``` update_users(Item) -> Value = binary_to_term(riak_object:get_value(Item)), [{_Key, Value}] = statebox:value(Item), Record = project_schema_user:new(Value), NewMetadata = project_schema_user:riak_metadata(Record), NewItem = riak_object:update_metadata(Item, NewMetadata), AItem = riak_object:apply_updates(NewItem), RiakcObj = to_riakc_obj(AItem), %% lager:info("Item ~p", [RiakcObj]), ok = redgage_riak_client:put(RiakcObj), []. to_riakc_obj(Object) when element(1, Object) =:= r_object -> #riakc_obj{ bucket = riak_object:bucket(Object), key = riak_object:key(Object), vclock = riak_object:encode_vclock(riak_object:vclock(Object)), contents = riak_object:get_contents(Object) %% updatemetadata = riak_object:get_update_metadata(Object), %% updatevalue = riak_object:get_update_value(Object) }. ``` It works! I had a problem with vclock. I got vclock from r_object, but it's vclock:vclock() type. Now I encode it. As you can see commented out two record's fields: updatemetadata and updatevalue. How do these fields work? 2017-02-25 0:40 GMT+03:00 Luke Bakken <lbak...@basho.com>: > Hi Grigory, > > Check out this article: > http://basho.com/posts/technical/webinar-recap-mapreduce-querying-in-riak/ > > Specifically, the use of riak:local_client() and C:put > -- > Luke Bakken > Engineer > lbak...@basho.com > > > On Thu, Feb 23, 2017 at 10:38 AM, Grigory Fateyev <gfb...@gmail.com> > wrote: > > Hello! > > > > I'm trying to write riak_pipe command that updates metadata, the code: > > https://gist.github.com/greggy/7d7fa3102d89673019410c6e244650cd > > > > I'm getting every entry in update_metadata/1 then creating a new > metadata, > > updating it in Item. > > > > My question is how to update r_object in a bucket? > > > > Thank you! > > > > _______________________________________________ > > riak-users mailing list > > riak-users@lists.basho.com > > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com > > >
_______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com