Performs a lookup-in operation against a document, fetching individual fields or information about specific fields inside the document value. Args: key (str): The key for the document look in. spec (Iterable[:class:`~couchbase.subdocument.Spec`]): A list of
(self,
key, # type: str
spec, # type: Iterable[Spec]
*opts, # type: LookupInOptions
**kwargs, # type: Any
)
| 749 | await self._impl.unlock(req, obs_handler) |
| 750 | |
| 751 | async def lookup_in(self, |
| 752 | key, # type: str |
| 753 | spec, # type: Iterable[Spec] |
| 754 | *opts, # type: LookupInOptions |
| 755 | **kwargs, # type: Any |
| 756 | ) -> LookupInResult: |
| 757 | """Performs a lookup-in operation against a document, fetching individual fields or information |
| 758 | about specific fields inside the document value. |
| 759 | |
| 760 | Args: |
| 761 | key (str): The key for the document look in. |
| 762 | spec (Iterable[:class:`~couchbase.subdocument.Spec`]): A list of specs describing the data to fetch |
| 763 | from the document. |
| 764 | opts (:class:`~couchbase.options.LookupInOptions`): Optional parameters for this operation. |
| 765 | **kwargs (Dict[str, Any]): keyword arguments that can be used in place or to |
| 766 | override provided :class:`~couchbase.options.LookupInOptions` |
| 767 | |
| 768 | Returns: |
| 769 | Awaitable[:class:`~couchbase.result.LookupInResult`]: A future that contains an instance |
| 770 | of :class:`~couchbase.result.LookupInResult` if successful. |
| 771 | |
| 772 | Raises: |
| 773 | :class:`~couchbase.exceptions.DocumentNotFoundException`: If the key provided does not exist |
| 774 | on the server. |
| 775 | |
| 776 | Examples: |
| 777 | |
| 778 | Simple look-up in operation:: |
| 779 | |
| 780 | import couchbase.subdocument as SD |
| 781 | |
| 782 | # ... other code ... |
| 783 | |
| 784 | bucket = cluster.bucket('travel-sample') |
| 785 | collection = bucket.scope('inventory').collection('hotel') |
| 786 | |
| 787 | key = 'hotel_10025' |
| 788 | res = await collection.lookup_in(key, (SD.get("geo"),)) |
| 789 | print(f'Hotel {key} coordinates: {res.content_as[dict](0)}') |
| 790 | |
| 791 | |
| 792 | Simple look-up in operation with options:: |
| 793 | |
| 794 | from datetime import timedelta |
| 795 | |
| 796 | import couchbase.subdocument as SD |
| 797 | from couchbase.options import LookupInOptions |
| 798 | |
| 799 | # ... other code ... |
| 800 | |
| 801 | key = 'hotel_10025' |
| 802 | res = await collection.lookup_in(key, |
| 803 | (SD.get("geo"),), |
| 804 | LookupInOptions(timeout=timedelta(seconds=2))) |
| 805 | print(f'Hotel {key} coordinates: {res.content_as[dict](0)}') |
| 806 | |
| 807 | """ |
| 808 | instruments = self._impl.observability_instruments |
no test coverage detected