Result Size: 625 x 571
demo_mongodb_update_many.py:
x
 
import pymongo
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["mydatabase"]
mycol = mydb["customers"]
myquery = { "address": { "$regex": "^S" } }
newvalues = { "$set": { "name": "Minnie" } }
x = mycol.update_many(myquery, newvalues)
print(x.modified_count, "documents updated.")
C:\Users\My Name>python demo_mongodb_update_many.py
2 documents updated.