After inserting the document inside the MongoDB collection, you can update the fields of the document with the help of an update function. Like say, for instance, you have inserted a document inside the collection as follows:
Then let suppose you want to update the field named college, then if you want to update only one field then you can use the updateOne() function, you just have to specify the document on which document you want to perform update function. As given in the below image I have updated the college name for the document that is having the name filed as “ABC”.
And if you want to update more fields then you can use updateMany() function, you just have to specify the document that on which you want to perform updation.