Skip to content

Instantly share code, notes, and snippets.

@JanPaulEttles
Created March 28, 2012 15:11
Show Gist options
  • Select an option

  • Save JanPaulEttles/2227033 to your computer and use it in GitHub Desktop.

Select an option

Save JanPaulEttles/2227033 to your computer and use it in GitHub Desktop.
jandefence1
> var cursor = db.coll.find().sort({"someNumber":1});
> var max = -1;
> while(cursor.hasNext()) {
... var current = cursor.next();
... if(current.someNumber > max) {
... max = current.someNumber;
... }
... }
90
> print(max);
90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment