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

Method list_size

couchbase/collection.py:1392–1424  ·  view source on GitHub ↗

Returns the number of items in the list. .. warning:: This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseList.size` instead. Args: key (str): The key for the list document. **kwargs (Dict[str, An

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

Source from the content-addressed store, hash-verified

1390 return OperationResult(sd_res.cas, sd_res.mutation_token())
1391
1392 def list_size(self, key: str, **kwargs: object) -> int:
1393 """Returns the number of items in the list.
1394
1395 .. warning::
1396 This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseList.size`
1397 instead.
1398
1399 Args:
1400 key (str): The key for the list document.
1401 **kwargs (Dict[str, Any]): keyword arguments that can be used as optional parameters
1402 for this operation.
1403
1404 Returns:
1405 int: The number of items in the list.
1406
1407 Raises:
1408 :class:`~couchbase.exceptions.DocumentNotFoundException`: If the key provided does not exist
1409 on the server.
1410
1411 """
1412 op_type = DatastructureOperationType.ListRemoveAt
1413 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
1414 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
1415 kv_op_type = KeyValueOperationType.LookupIn
1416 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
1417 op = count('')
1418 req, transcoder = self._impl.request_builder.build_lookup_in_request(key, (op,), obs_handler, **kwargs)
1419 sd_res = self._execute_deprecated_ds_func(self._impl.lookup_in,
1420 req,
1421 obs_handler,
1422 ds_obs_handler.wrapped_span,
1423 transcoder=transcoder)
1424 return sd_res.value[0].get('value', None)
1425
1426 def couchbase_map(self, key: str) -> CouchbaseMap:
1427 """Returns a CouchbaseMap permitting simple map storage in a document.

Callers 3

set_sizeMethod · 0.95
queue_sizeMethod · 0.95
test_listMethod · 0.80

Calls 7

countFunction · 0.90
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45
getMethod · 0.45

Tested by 1

test_listMethod · 0.64