Skip to content

Instantly share code, notes, and snippets.

@makeittotop
Last active August 29, 2015 14:17
Show Gist options
  • Save makeittotop/af9c5cd5ebbd27037ea8 to your computer and use it in GitHub Desktop.
Save makeittotop/af9c5cd5ebbd27037ea8 to your computer and use it in GitHub Desktop.
query data and iterate over the matched data
var cur = db.tasks.find({
'$or': [
{'upload_status': 'active'},
{'upload_status': 'pending'}]
});
while(cur.hasNext()) {
printjson(cur.next());
}
# or easier yet
cur.forEach(printjson);
# convert a cursor to an array
var docs = cur.toArray();
var doc = docs[3];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment