Skip to content

Instantly share code, notes, and snippets.

@bernerdschaefer
Created July 23, 2010 15:10
Show Gist options
  • Save bernerdschaefer/487553 to your computer and use it in GitHub Desktop.
Save bernerdschaefer/487553 to your computer and use it in GitHub Desktop.
require 'mongoid'
require 'rspec'
Mongoid.configure do |config|
config.master = Mongo::Connection.new.db('testing')
end
class Foo
include Mongoid::Document
field :size, :type => Integer
collection.remove
end
Foo.create(:size => 4)
Foo.create(:size => 6)
Foo.create(:size => 8)
Foo.create(:size => 10)
Foo.where(:size.gt => 4).and(:size.lt => 10).size.should == 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment