The MongoDB $setOnInsert
field update operator can be used to insert a specific value during an upsert.
If an update operation results in a new document being inserted (i.e. an upsert), then the $setOnInsert
operator takes effect, otherwise it has no effect.