Lets use $set operator along with update() method, to update the documents. test database, names collection > db.names.find() { "_id"…