Retrieve the object matching the id provided. Uses `object_id` only and raises InvalidQueryError if a filter has been applied. Returns `None` if no document exists with that id. :param object_id: the value for the id of the document to look up
(self, object_id)
| 751 | return result |
| 752 | |
| 753 | def with_id(self, object_id): |
| 754 | """Retrieve the object matching the id provided. Uses `object_id` only |
| 755 | and raises InvalidQueryError if a filter has been applied. Returns |
| 756 | `None` if no document exists with that id. |
| 757 | |
| 758 | :param object_id: the value for the id of the document to look up |
| 759 | """ |
| 760 | queryset = self.clone() |
| 761 | if queryset._query_obj: |
| 762 | msg = "Cannot use a filter whilst using `with_id`" |
| 763 | raise InvalidQueryError(msg) |
| 764 | return queryset.filter(pk=object_id).first() |
| 765 | |
| 766 | def in_bulk(self, object_ids): |
| 767 | """Retrieve a set of documents by their ids. |