Skip to content

Instantly share code, notes, and snippets.

@chandlerkent
Created August 5, 2011 03:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandlerkent/1126842 to your computer and use it in GitHub Desktop.
Save chandlerkent/1126842 to your computer and use it in GitHub Desktop.
function(doc) {
if (doc.type === "game") {
var new_seats = [];
var seats = doc.seats;
for (var i = 0; i < seats.length; i++) {
if (parseInt(seats[i].price, 10) < 50) {
new_seats.push(seats[i]);
}
}
doc.seats = new_seats;
if (doc.seats.length > 0) {
emit(doc.date, doc);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment