I think this option should be set by default:
https://docs.mongodb.com/manual/reference/operator/update/setOnInsert/#up._S_setOnInsert
Profile::whereId(1)->update(['name' => 'joe'],['upsert' => true]);
This produces the updated_at but is missing created_at.
+1
Why issue is close?
@quando12 i'm not sure that it's expected behavior
What is the alternative here, use create() if you cannot first find()? upsert (by definition) would create a new document if one could not be found. This (in my opinion) should cause the created_at field to be included automatically.
+1
Most helpful comment
+1