replaceone mogodbb
In MongoDB, you are allowed to replace an existing document with a new document in the collection with the help of db. collection. ... replaceOne() is a mongo shell method, which only replaces one document at a time. The replacement document may contain different fields as compared to the original document.