Modify output to be generated in MongoDB with inserts and upserts.