You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed when I initially synced all my models over to Mongo, that I accidentally set the dates as strings. When I went to re-sync, I noticed an odd issue with converting dates.
I have a simple sync job that takes an update action, pulls all the existing values from my MySql model, finds the existing Mongo model, then copies the attributes over. Here's what it looks like:
Context: ->toMoloquent() just creates a Moloquent model instance from my MySql model (different att schemas)
When I do this, if date attributes were previously saved to Mongo as strings, it will not convert them to Mongo BSON dates. It leaves them as strings. I have to do this to make it work:
I have my protected $dates attribute set up correctly on my model, and it works fine when creating a fresh model, and if the dates were saved properly in the first place. I've also confirmed that $updatedModel's date attributes are indeed Mongo BSON dates that I'm passing into ->fill().
Help!
The text was updated successfully, but these errors were encountered:
I noticed when I initially synced all my models over to Mongo, that I accidentally set the dates as strings. When I went to re-sync, I noticed an odd issue with converting dates.
I have a simple sync job that takes an update action, pulls all the existing values from my MySql model, finds the existing Mongo model, then copies the attributes over. Here's what it looks like:
Context:
->toMoloquent()
just creates a Moloquent model instance from my MySql model (different att schemas)When I do this, if date attributes were previously saved to Mongo as strings, it will not convert them to Mongo BSON dates. It leaves them as strings. I have to do this to make it work:
I have my
protected $dates
attribute set up correctly on my model, and it works fine when creating a fresh model, and if the dates were saved properly in the first place. I've also confirmed that$updatedModel
's date attributes are indeed Mongo BSON dates that I'm passing into->fill()
.Help!
The text was updated successfully, but these errors were encountered: