Alternative to Post-Commit in EDS

Alexander Sicular siculars at
Thu Apr 5 15:17:01 EDT 2012

On Apr 4, 2012, at 12:20 PM, Anthony Molinaro wrote:

> Is it not possible to use the last modified filed in a Map/Reduce?  

You can, in fact, access, use and return the automatically recorded last modified field (along with all the other metadata stored by Riak) in your map like so:

lastMod = v["values"][0]["metadata"]["X-Riak-Last-Modified"];

However, I would consider explicitly recording that data in your value depending on your application and use case. I had a situation where an application used that value to display data to the user determining sort ordering and the like. But... I had to programmatically re-write the data to accommodate additional data elements -AND- re index the data with a new Riak Search schema, which a read alone will not do - you need a read and a write. So, you can imagine, had I not written a script to pull that last modified data from the header and explicitly record it in the value that all my records would have the same last modified time. 

Sometimes you're the hammer. Sometimes you're the nail. 

-Alexander Sicular


More information about the riak-users mailing list