Skip to content

Instantly share code, notes, and snippets.

@amyberman3
Created May 23, 2014 17:51
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 amyberman3/0a4dc052d48196baa924 to your computer and use it in GitHub Desktop.
Save amyberman3/0a4dc052d48196baa924 to your computer and use it in GitHub Desktop.
p6
// find the parent ‘host’ document
> host = db.hosts.findOne({ipaddr : '127.66.66.66'}); // assumes unique index
// find the most recent 5000 log message documents linked to that host
> last_5k_msg = db.logmsg.find({host: host._id}).sort({time : -1}).limit(5000).toArray()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment