Update with upsert: MongoDB

preview_player
Показать описание


Lets learn to use upsert option with update() method.

upsert basically inserts document into the collection, if there is no match found. If there is a match found, then the document simply gets updated -- in which case upsert option will not have any effect on the selected document.

MongoDB Video Tutorial List:
Рекомендации по теме
Комментарии
Автор

Nice tutorial. I face a problem in updating when i update a collection, the document position are changed.

eparthad
Автор

Thanks for the tutorial.  Much appreciated.

ezekielthemack
Автор

hi bro I am working on python
I have scrap url and insert in mongo db but when I again scrap same URL it will insert again URLs some duplication happen how can I remove second-time duplication error.
for url in item['url']:

return item

AliRaza-tfuj