Skip to content
Advertisement

pymongo update all documents in collection for field with it’s substring value

JavaScript

Desired output

JavaScript

in other words substring [:3]

How can I achieve this with pymongo

Advertisement

Answer

You can use updatemany with an aggregation : https://docs.mongodb.com/manual/tutorial/update-documents-with-aggregation-pipeline/

JavaScript
Advertisement