- Laravel-mongodb Version: 3.6.6
- PHP Version: 7.3
- Database Driver & Version:
Description:
Updating documents with the ->update() method saves Carbon dates as Object instead of Date in the database. Doing the same using ->save() on a model works fine. Yes, the models have the property registered as a date in the $dates array.
Steps to reproduce
- Create model with property 'end_date'. Add property to $dates array on the model.
- Create date $date = Carbon::parse('2021-01-08 10:00');
- Run query: Model::where('match', true)->update(['end_date' => $date]);
- Check db.
Expected behaviour
The end_dateshould be saved as a field of type Date instead of Object

Actual behaviour
end_date is saved as object

Additionally, if you were to do ->update(['end_date' => $date->toIso8601String()]) the date would be saved as a String field
Description:
Updating documents with the ->update() method saves Carbon dates as Object instead of Date in the database. Doing the same using ->save() on a model works fine. Yes, the models have the property registered as a date in the $dates array.
Steps to reproduce
Expected behaviour
The end_dateshould be saved as a field of type Date instead of Object

Actual behaviour
end_date is saved as object

Additionally, if you were to do ->update(['end_date' => $date->toIso8601String()]) the date would be saved as a String field