Ticket Details

MongoDate Object being converted to array before save()

BUG Ticket (closed)

###What happened:
When creating a field with a MongoDate object Li3 is converting it to an array before saving. MongoDB will then accept the following: "date" : { "sec" : 1277942400, "usec" : 0 }. 



###What was expected:

The field with a date should be in the form of "Thu May 27 2010 14:40:09 GMT-0400 (EDT)" after saving which is an indication that the MongoDate object was accepted.


See [the commit in my fork](http://rad-dev.org/forks/fitzagard/lithium/commits/view/fad6ee838f558f8ad844627741b35db7fb073a32) for the test of MongoDate Preservation.
on 07.06.10 reported by: fitzagard owned by: nate

Updates

on 07.06.10 by fitzagard
  • priority was changed to normal
on 07.06.10 by fitzagard
The following php paste will temporarily fix the mongodate bug:

http://pastium.org/view/2775c74f61facdb3223349a3109adfd7

It would be called via MongoDb::create() with {{{$data = $self->invokeMethod('_toMongoDate', array($query->data()));}}}
on 07.06.10 by fitzagard
Updated the test testMongoDatePreservation() with the following:

{{{ 
$this->assertEqual($now->sec, $dataById['created']->sec);
$this->assertEqual($now->sec, $dataByDate['created']->sec);
}}}

http://rad-dev.org/forks/fitzagard/lithium/commits/view/f2f6a24076ebb557a302d1e8aaef8d7405a77382
on 07.07.10 by fitzagard
Modified test case so it takes into account fields that have been updated and saved. See [commit here](http://rad-dev.org/forks/fitzagard/lithium/commits/view/abf2de79035c35c563fb3d5d3baf07153c31b59f)

Also, the temp fix as suggested above will need to be applied in MongoDb::update().
on 07.15.10 by jperras
  • owner was removed
on 08.12.10 by jperras
  • owner was changed to jperras
  • status was changed to in progress
on 08.18.10 by nate
  • owner was changed to nate
(fixed) on 09.22.10 by nate
  • status was changed to closed
  • resolution was changed to fixed
Fixed in the x-data branch.