Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Created November 27, 2014 13:05
Show Gist options
  • Select an option

  • Save mauritslamers/0e0817b6cadac3ce4714 to your computer and use it in GitHub Desktop.

Select an option

Save mauritslamers/0e0817b6cadac3ce4714 to your computer and use it in GitHub Desktop.
"most_recent_profile": {
"map": "function (doc) {\n
if (doc.type === 'personal_data') {\n
emit(doc._id, doc);\n
}\n}",
"reduce": "function (key, values, rereduce) {\n
var r = values[0];\n
for (var i = 1; i < values.length; i += 1) {\n
if (r.timestamp < values[i].timestamp) r = values[i];\n
}\n
return r;\n
}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment