Skip to content

Instantly share code, notes, and snippets.

@dmcassel
Created September 14, 2015 17:58
Show Gist options
  • Save dmcassel/0d143abbe6b05b7b87e0 to your computer and use it in GitHub Desktop.
Save dmcassel/0d143abbe6b05b7b87e0 to your computer and use it in GitHub Desktop.
function* asObjects(itr) {
for(var doc of itr) {
yield doc.toObject();
}
}
var a = [];
for(var obj of asObjects(fn.collection())) {
// Assumes you have JSON documents in the database with .name properties, as in the examples below.
a.push(obj.name = "Generated: " + obj.name);
}
a;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment