Hi all,

I have a document with some broken links (i.e. that point to a
non-existent key), and want to apply a map/reduce there.

var map = function(v, k, args) { ejsLog("/tmp/mr", "hello from map");
return [{from: "map"}] }

  db.link({ bucket: "highlights", keep: false })
    .map({source: map})
    .run([["user_chapters", id]])()

(That is, apply link+map to users_chapters/id)

Result: 
[{"not_found":{"bucket":"highlights","key":"f542e13e0b5cece1f637be384e685667"}}]

Makes sense because that is true. But why don't I get [{from: "map"}],
and why is nothing logged?

I presume it is just failing at the link phase, which then outputs no
keys for the following phases. The "not found" objects should be get
rid of at a node level, so I don't think they belong to a reduce
phase. Or is that the case?

(FWIW i got inspiration from Riak.mapValuesJson which seems to deal
with not_founds, but I never actually seem to reach the map phase).

What is the recommended approach to gracefully handle broken links? It
should be fairly easy to exclude not found results from the resulting
map/reduce array.

Francisco

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to