Skip to content

Instantly share code, notes, and snippets.

@jraines
Created November 2, 2010 18:54
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 jraines/660100 to your computer and use it in GitHub Desktop.
Save jraines/660100 to your computer and use it in GitHub Desktop.
#two questions -- why does .count not return the narrowed down result set size, and why does .where seem to alter variable a?
a = Star.where(:brightness => 0)
=> #<Mongoid::Criteria:0xb6af2948 @documents=[], @options={}, @selector={:brightness=>0}, @klass=Star>
a.size
=> 1430
a.count
=> 1430
a.where(:name => /local/).count
=> 1430
a.where(:name => /local/).size
=> 286
a.count
=> 1430
a.size
=> 286
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment