Skip to main content

Update

Basic

This method interacts with the Basic Update endpoint to update a resource.

Usage

const response = await userService.update('79c8c567b05e986509d55733a', { public: false });

Parameters

ParameterTypeDescription
identifierstringUnique identifier of the resource to be updated.
dataobjectData for updating the resource.
optionsUpdateOptions (optional)Additional options for customizing the update operation.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface UpdateOptions {
returningAll?: boolean; // Set to `true` to return all fields in the response.
}

Response

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
rawobjectRaw data received from the server.
dataModelParsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
raw: {
_id: '79c8c567b05e986509d55733a',
name: 'Lucy',
role: 'user',
public: false,
_permissions: {}
},
data: Model {
_id: [Getter/Setter],
name: [Getter/Setter],
role: [Getter/Setter],
public: [Getter/Setter],
_permissions: [Getter/Setter]
},
headers: Object [AxiosHeaders] {}
}

Advanced

This method interacts with the Advanced Update endpoint to update a resource with advanced options.

Usage

const response = await userService.update('79c8c567b05e986509d55733a', { public: false }, { select: ['name'] });

Parameters

ParameterTypeDescription
identifierstringUnique identifier of the resource to be updated.
dataobjectData for updating the resource.
argsUpdateAdvancedArgs (optional)Advanced arguments for controlling the update operation.
optionsUpdateAdvancedOptions (optional)Additional options for customizing the advanced update operation.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.
interface UpdateAdvancedArgs {
select?: Projection; // Projection for selecting specific fields.
populate?: Populate[] | Populate | string; // Data to populate in the response.
}

interface UpdateAdvancedOptions {
returningAll?: boolean; // Set to `true` to return all updated fields in the response.
includePermissions?: boolean; // Include permissions in the response.
populateAccess?: PopulateAccess; // Options for populating access-related data.
}

Response

PropTypeDescription
successbooleanIndicates whether the request was successful.
statusnumberHTTP status code of the response.
messagestringA message providing additional information about the response, especially in case of errors.
rawobjectRaw data received from the server.
dataModelParsed data represented as an array of Model instances.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 200,
raw: {
_id: '79c8c567b05e986509d55733a',
name: 'Lucy',
_permissions: {}
},
data: Model {
_id: [Getter/Setter],
name: [Getter/Setter],
_permissions: [Getter/Setter]
},
headers: Object [AxiosHeaders] {}
}