October 2018
Intermediate to advanced
332 pages
8h 9m
English
To update objects, the update method is called on the results of a query, as follows:
>>> Post.objects(
id="5534451d8b84ebf422c2e4c8"
).update(text="Ipsum lorem")
If your query should only return one value, then use update_one to only modify the first result, as follows:
>>> Post.objects(
id="5534451d8b84ebf422c2e4c8"
).update_one(text="Ipsum lorem")
Unlike traditional SQL, there are many different ways to change a value in MongoDB. Operators are used to change the values of a field in the following different ways: