Created
August 27, 2010 13:29
-
-
Save johnnygoodman/553345 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Expense | |
include MongoMapper::Document | |
key :expense_id. ObjectId | |
key :amount, Integer | |
key :date, Date | |
key :notes, String | |
key :tags, Array | |
key :category, Array | |
end | |
MongoMapper.database = 'expense' | |
Expense.collection.remove | |
Expense.create(:amount => '25.00', | |
:date => Time.parse('08/26/2010'), | |
:notes => 'An Expense', | |
:tags => %w[Company1 Company 2], | |
:category => %w[Freight Web Hosting]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would avoid using Date. Just use Time. Date's are not native to mongo but times are.