MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / map_remove

Method map_remove

couchbase/collection.py:1519–1552  ·  view source on GitHub ↗

Remove an item from a map. .. warning:: This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseMap.remove` instead. Args: key (str): The key for the map document. mapkey (str): The key in the map to

(self, key: str, mapkey: str, **kwargs: object)

Source from the content-addressed store, hash-verified

1517 return sd_res.value[0].get('value', None)
1518
1519 def map_remove(self, key: str, mapkey: str, **kwargs: object) -> OperationResult:
1520 """Remove an item from a map.
1521
1522 .. warning::
1523 This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseMap.remove`
1524 instead.
1525
1526 Args:
1527 key (str): The key for the map document.
1528 mapkey (str): The key in the map to set.
1529 **kwargs (Dict[str, Any]): keyword arguments that can be used as optional parameters
1530 for this operation.
1531
1532 Returns:
1533 :class:`~couchbase.result.OperationResult`: An instance of :class:`~couchbase.result.OperationResult`.
1534
1535 Raises:
1536 :class:`~couchbase.exceptions.DocumentNotFoundException`: If the key provided does not exist
1537 on the server.
1538
1539 """
1540 op_type = DatastructureOperationType.MapRemove
1541 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
1542 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
1543 kv_op_type = KeyValueOperationType.MutateIn
1544 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
1545 op = subdoc_remove(mapkey)
1546 req = self._impl.request_builder.build_mutate_in_request(key, (op,), obs_handler, **kwargs)
1547 sd_res = self._execute_deprecated_ds_func(self._impl.mutate_in,
1548 req,
1549 obs_handler,
1550 ds_obs_handler.wrapped_span,
1551 path_value=mapkey)
1552 return OperationResult(sd_res.cas, sd_res.mutation_token())
1553
1554 def map_size(self, key: str, **kwargs: object) -> int:
1555 """Get the number of items in the map.

Callers 1

test_mapMethod · 0.80

Calls 7

OperationResultClass · 0.90
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45
mutation_tokenMethod · 0.45

Tested by 1

test_mapMethod · 0.64