If the out field for mapReduce has 'sharded: true', the output collection cannot be an existing unsharded collection. We fail the mapReduce command in this case.
https://docs.mongodb.com/manual/reference/command/mapReduce/index.html – add a note to the section that describes the "sharded" parameter in the out stage/
mapReduce with a sharded output collection assigns the UUID obtained from the config server to the final output collection. mapReduce "replace" will drop the existing output collection, which has the same UUID as the new output collection. Two-phase-drop may cause the dropCollection to finish after the renameCollection finishes, erroneously removing the UUIDCatalog entry for the output collection.