The unix()
method returns the seconds since the Unix epoch, but MongoDB uses the JavaScript style of milliseconds since the epoch.
It's best to just get the JavaScript Date
object that moment
wraps using toDate()
:
Service.user.updateMyDate({myDate: moment().toDate()});