Hi Bryce:

Guess I thought it would be something along the lines of the sample code:
"source":"function(riakObject) {
      var val = riakObject.values[0].data.match(/pizza/g);
      return [[riakObject.key, (val ? val.length : 0 )]];
    }"}}]}'

Except that riakObject.values would be replaced by riakObject.metadata (except 
I'd not yet determined the proper terminology).
-nd


----- Original Message -----
> From: "Bryce Verdier" <[email protected]>
> To: [email protected]
> Sent: Monday, December 30, 2013 3:43:52 PM
> Subject: Re: Trying to understand map/reduce of meta-data
> 
> Hi,
> 
> I'm still new to the underpinnings of working with MapReduce in Riak.
> That being said I think what you're looking for is possible, though
> I'm
> sure someone else might be able to share a better way with you.
> 
> Using some custom code(
> http://docs.basho.com/riak/latest/ops/advanced/install-custom-code/)
> you
> could write what you're looking for.
> 
> _NOTE_, this is untested... you've been warned!
> 
> getMetaData(RiakObject, _KeyData, _Arg) ->
>      Key   = riak_object:key(RiakObject),
>      Data = riak_object:get_metadata(RiakObject),
>      [ {Key, Data} ].
> 
> On 12/30/2013 12:10 PM, Nooby Doo wrote:
> > Hello:
> >
> > I'm trying to understand how to do a map/reduce referring to
> > meta-data.
> > Example (I'm using JavaScript).
> >
> > I have a meta-data field called X-Riak-Meta-start-time; the
> > contents of which are a Unix timestamp.
> > I'd like to find all keys with a timestamp older than now() - 30
> > days ago.
> > Reading through the documentation this seems to be straight forward
> > if I was looking at the actual data being stored, however, I'm
> > simply unclear as to how to do while looking at a MetaData field.
> >
> > Appreciate any help you can provide.
> > -nd
> >
> > _______________________________________________
> > riak-users mailing list
> > [email protected]
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 
> 
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to