For your task, there is a function db.collection.renameCollection() in MongoDB which will help you to change the name of the collection, refer to the following code:
db.collection.renameCollection(target, dropTarget)
target: new name of the collection inside single quotations(‘new_name_of_the_collection’)
dropTarget: this parameter is optional. dropTarget is of boolean value and by default it is false. If this value is true then the mongod drops the target of renameCollection before renaming the collection.
If you want to learn more about MongoDB then go through this MongoDB course for more insights.
MongoDB is an important part of full-stack development. Enroll in this Full Stack Developer Training to start your journey in this field.