Implements $setOnInsert.