2013-03-23 60 views
3

我試着去日期時間信息保存到中的以下蒙戈保存日期/時間使用mongomapper

key :last_comment_time_cache, DateTime 

update_attributes!({:last_comment_time_cache => Time.now}) 

正在被保存丟失的時間

"last_comment_time_cache": { 
    "$date": "2013-03-23T00:00:00.000Z" 
} 

什麼任何想法的數據即時做錯了?,謝謝納斯

回答

4

嘗試更改字段類型爲Time而不是DateTime。如果你看他們的Date擴展hereDateDateTimeparent)他們只考慮day,month and year考慮,以構建將被髮送到蒙戈的日期,這不是他們的Time執行情況。

+0

這樣做的技巧謝謝 – Nath 2013-03-24 08:43:53

相關問題