Open
Description
My Notification model is as follows;
use Jenssegers\Mongodb\Eloquent\Model as Eloquent;
class Notification extends Eloquent {
protected $collection = 'notification';
protected $dates = ['readDate'];
protected $guarded = [];
public $timestamps = false;
}
If I update the model as follows it works fine and saved date is a proper ISODate
Notification::find($id)->update(['readDate' => now()]);
{
"_id" : ObjectId("5d9ce7970c3e09489a42a4a2"),
"title" : "test",
"readDate" : ISODate("2019-10-08T19:46:30.000Z"),
}
But if I make a single update with query builder, the saved date is stored as an object
Notification::where('_id', $id)->update(['readDate' => now()]);
{
"_id" : ObjectId("5d9ce7970c3e09489a42a4a2"),
"title" : "test",
"readDate" : {
"date" : "2019-10-08 23:56:24.467242",
"timezone_type" : 3,
"timezone" : "Europe/Istanbul"
}
}
Shouldn't both behave same for fields that are defined in $dates array in model definition?