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

Method list_append

couchbase/collection.py:1183–1226  ·  view source on GitHub ↗

Add an item to the end of a list. .. warning:: This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseList.append` instead. Args: key (str): The key for the list document. value (JSONType): The value

(self,
                    key: str,
                    value: JSONType,
                    create: Optional[bool] = False,
                    **kwargs: object)

Source from the content-addressed store, hash-verified

1181 raise IndexError(path_value)
1182
1183 def list_append(self,
1184 key: str,
1185 value: JSONType,
1186 create: Optional[bool] = False,
1187 **kwargs: object) -> OperationResult:
1188 """Add an item to the end of a list.
1189
1190 .. warning::
1191 This method is deprecated and will be removed in the 4.7.0 version. Use :meth:`.CouchbaseList.append`
1192 instead.
1193
1194 Args:
1195 key (str): The key for the list document.
1196 value (JSONType): The value to append to the list.
1197 create (bool, optional): Whether the list should be created if it does not exist.
1198 **kwargs (Dict[str, Any]): keyword arguments that can be used as optional parameters
1199 for this operation.
1200
1201 Returns:
1202 :class:`couchbase~.result.OperationResult`: An instance of :class:`~couchbase.result.OperationResult`.
1203
1204 Raises:
1205 :class:`~couchbase.exceptions.DocumentNotFoundException`: If the key provided does not exist
1206 on the server.
1207
1208 """
1209 op_type = DatastructureOperationType.ListAppend
1210 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
1211 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
1212 kv_op_type = KeyValueOperationType.MutateIn
1213 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
1214 op = array_append('', value)
1215 req = self._impl.request_builder.build_mutate_in_request(key,
1216 (op,),
1217 obs_handler,
1218 **kwargs)
1219 sd_res = self._execute_deprecated_ds_func(self._impl.mutate_in,
1220 req,
1221 obs_handler,
1222 ds_obs_handler.wrapped_span,
1223 create=create,
1224 create_type=list,
1225 path_value=value)
1226 return OperationResult(sd_res.cas, sd_res.mutation_token())
1227
1228 def list_prepend(self,
1229 key: str,

Callers 1

test_listMethod · 0.80

Calls 8

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

Tested by 1

test_listMethod · 0.64