Skip to content

Instantly share code, notes, and snippets.

@flyinprogrammer
Last active December 10, 2015 20:48
Show Gist options
  • Save flyinprogrammer/4490672 to your computer and use it in GitHub Desktop.
Save flyinprogrammer/4490672 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'date'
require 'mongoid'
Mongoid::Config.connect_to("email_test")
class Email
include Mongoid::Document
field :headers
field :received
field :date, :type => DateTime
field :to
field :from
field :subject
field :body
end
puts Email.where(:date.gte => DateTime.parse(Time.now.to_s)).count
## Fixed
But wth is going on with ":date.gte" <-- i.e. how does that create a key value for the hash?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment