Skip to content

Instantly share code, notes, and snippets.

@iyanski
Created March 30, 2012 16:49
Show Gist options
  • Save iyanski/2252788 to your computer and use it in GitHub Desktop.
Save iyanski/2252788 to your computer and use it in GitHub Desktop.
Counting results when specifying limit() in mongoid now works
1.9.2p290 :022 > Photo.all.count
=> 21
1.9.2p290 :023 > Photo.where(orientation: 'portrait').limit(2).count
=> 9
1.9.2p290 :024 > Photo.where(orientation: 'portrait').limit(2).count(true)
=> 2
1.9.2p290 :025 >
@ahmadpriatama
Copy link

@rgaufman thanks, this save me alot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment