Updates the embedded documents with the given replacement values. This function does not support mongoDB update operators such as ``inc__``. .. note:: The embedded document changes are not automatically saved to the database after calling this method
(self, **update)
| 330 | return len(values) |
| 331 | |
| 332 | def update(self, **update): |
| 333 | """ |
| 334 | Updates the embedded documents with the given replacement values. This |
| 335 | function does not support mongoDB update operators such as ``inc__``. |
| 336 | |
| 337 | .. note:: |
| 338 | The embedded document changes are not automatically saved |
| 339 | to the database after calling this method. |
| 340 | |
| 341 | :param update: A dictionary of update values to apply to each |
| 342 | embedded document. |
| 343 | :return: The number of entries updated. |
| 344 | """ |
| 345 | if len(update) == 0: |
| 346 | return 0 |
| 347 | values = list(self) |
| 348 | for item in values: |
| 349 | for k, v in update.items(): |
| 350 | setattr(item, k, v) |
| 351 | |
| 352 | return len(values) |
| 353 | |
| 354 | |
| 355 | class StrictDict: |
no test coverage detected