Integrates the collection's shard key to the `select_dict`, which will be used for the query. The value from the shard key is taken from the `doc` and finally the select_dict is returned.
(self, doc, select_dict)
| 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. |
| 536 | The value from the shard key is taken from the `doc` and finally the select_dict is returned. |
| 537 | """ |
| 538 | |
| 539 | # Need to add shard key to query, or you get an error |
| 540 | shard_key = self._meta.get("shard_key", tuple()) |
| 541 | for k in shard_key: |
| 542 | path = self._lookup_field(k.split(".")) |
| 543 | actual_key = [p.db_field for p in path] |
| 544 | val = doc |
| 545 | for ak in actual_key: |
| 546 | val = val[ak] |
| 547 | select_dict[".".join(actual_key)] = val |
| 548 | |
| 549 | return select_dict |
| 550 | |
| 551 | def _save_update(self, doc, save_condition, write_concern): |
| 552 | """Update an existing document. |
no test coverage detected