Wrap the result in a :class:`~mongoengine.Document` object.
(self)
| 1639 | # Iterator helpers |
| 1640 | |
| 1641 | def __next__(self): |
| 1642 | """Wrap the result in a :class:`~mongoengine.Document` object.""" |
| 1643 | if self._none or self._empty: |
| 1644 | raise StopIteration |
| 1645 | |
| 1646 | raw_doc = next(self._cursor) |
| 1647 | |
| 1648 | if self._as_pymongo: |
| 1649 | return raw_doc |
| 1650 | |
| 1651 | doc = self._document._from_son( |
| 1652 | raw_doc, |
| 1653 | _auto_dereference=self._auto_dereference, |
| 1654 | ) |
| 1655 | |
| 1656 | if self._scalar: |
| 1657 | return self._get_scalar(doc) |
| 1658 | |
| 1659 | return doc |
| 1660 | |
| 1661 | def rewind(self): |
| 1662 | """Rewind the cursor to its unevaluated state.""" |
nothing calls this directly
no test coverage detected