Skip to main content

Create

Basic​

This method creates a single resource sub-document resource.

Usage​

const response = await services.userService
.id("79c8c567b05e986509d55733a")
.subs("statusHistory")
.create({ name: 'free', status: true });

Parameters​

ParameterTypeDescription
dataobjectData for creating the resource.
axiosRequestConfigAxiosRequestConfig (optional)Axios request configuration for fine-tuning the HTTP request.

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.
dataobjectRaw data received from the server.
headersobject[AxiosHeaders]Axios headers associated with the response.
{
success: true,
status: 201,
raw: {
_id: '5e9553c0d09768056739c8cb7',
name: 'free',
active: true
},
data: {
_id: '5e9553c0d09768056739c8cb7',
name: 'free',
active: true
},
headers: Object [AxiosHeaders] {}
}