Skip to content

Instantly share code, notes, and snippets.

@neumino
Created December 11, 2013 01:30
Show Gist options
  • Save neumino/7903626 to your computer and use it in GitHub Desktop.
Save neumino/7903626 to your computer and use it in GitHub Desktop.
@bencevans - Twitter - 2013/12/10
r.db("ScrobbleGraph").table("scrobbles").groupedMapReduce(
function(doc) { return doc("date").date() },
function(doc) { return [doc] },
function(left, right) { return left.add(right)}
)
// It's better to use just an orderBy and group on the client because
// - The database won't have to keep everything in memory
// - It's faster because of the index
r.db("ScrobbleGraph").table("scrobbles").orderBy({index: "date"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment