Return a dict containing all the $set and $unset operations that should be sent to MongoDB based on the changes made to this Document.
(self)
| 517 | return object_id |
| 518 | |
| 519 | def _get_update_doc(self): |
| 520 | """Return a dict containing all the $set and $unset operations |
| 521 | that should be sent to MongoDB based on the changes made to this |
| 522 | Document. |
| 523 | """ |
| 524 | updates, removals = self._delta() |
| 525 | |
| 526 | update_doc = {} |
| 527 | if updates: |
| 528 | update_doc["$set"] = updates |
| 529 | if removals: |
| 530 | update_doc["$unset"] = removals |
| 531 | |
| 532 | return update_doc |
| 533 | |
| 534 | def _integrate_shard_key(self, doc, select_dict): |
| 535 | """Integrates the collection's shard key to the `select_dict`, which will be used for the query. |