Skip to content

Instantly share code, notes, and snippets.

@makeittotop
Last active May 17, 2016 11:46
Show Gist options
  • Save makeittotop/b6d6bdbad67960910483 to your computer and use it in GitHub Desktop.
Save makeittotop/b6d6bdbad67960910483 to your computer and use it in GitHub Desktop.
A mongodb function to wade through a collection and report the `status` of a particular `stream`.
function find_info(stream, status) {
var query = {};
var key = stream + "_status";
query[key] = status;
db.tasks.find(query).forEach(
function(doc) {
print("Task " + status + ": " + doc[stream+"_id"] +", owner: " + doc.task_owner);
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment