Skip to content

Instantly share code, notes, and snippets.

@jgyllen
Created November 9, 2011 21:38
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 jgyllen/1353155 to your computer and use it in GitHub Desktop.
Save jgyllen/1353155 to your computer and use it in GitHub Desktop.
Equivalent of using MongoDB's $size operator for embedded collections
# All activities with one comment or more
Activity.collection.find('$where' => "function() { if (this['activity_comments'] && this['activity_comments'].length > 0) return true; }")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment