Sets a specific key to the specified value in the map. Args: mapkey (str): The key to set. value (JSONType): The value to set.
(self, mapkey: str, value: Any)
| 430 | transcoder=transcoder) |
| 431 | |
| 432 | def add(self, mapkey: str, value: Any) -> None: |
| 433 | """Sets a specific key to the specified value in the map. |
| 434 | |
| 435 | Args: |
| 436 | mapkey (str): The key to set. |
| 437 | value (JSONType): The value to set. |
| 438 | |
| 439 | """ |
| 440 | op_type = DatastructureOperationType.MapAdd |
| 441 | with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler: |
| 442 | ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict()) |
| 443 | kv_op_type = KeyValueOperationType.MutateIn |
| 444 | with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler: |
| 445 | op = upsert(mapkey, value) |
| 446 | req = self._impl.request_builder.build_mutate_in_request(self._key, |
| 447 | (op,), |
| 448 | obs_handler, |
| 449 | parent_span=ds_obs_handler.wrapped_span) |
| 450 | return self._execute_op(self._impl.mutate_in, |
| 451 | req, |
| 452 | obs_handler, |
| 453 | ds_obs_handler.wrapped_span, |
| 454 | create_type=True) |
| 455 | |
| 456 | def get(self, mapkey: str) -> Any: |
| 457 | """Fetches a specific key from the map. |