Read
Basic
This method retrieves a single resource sub-document resource by its identifier.
Usage
const response = await services.userService
.id("79c8c567b05e986509d55733a")
.subs("statusHistory")
.read('95ac058c573be9879d059c663');
Parameters
Parameter | Type | Description |
---|---|---|
subId | string | The ID of the sub-document resource to be retrieved. |
axiosRequestConfig | AxiosRequestConfig (optional) | Axios request configuration for fine-tuning the HTTP request. |
Response
Prop | Type | Description |
---|---|---|
success | boolean | Indicates whether the request was successful. |
status | number | HTTP status code of the response. |
message | string | A message providing additional information about the response, especially in case of errors. |
raw | object | Raw data received from the server. |
data | object | Raw data received from the server. |
headers | object[AxiosHeaders] | Axios headers associated with the response. |
- 200
- 401
- 403
- 404
{
success: true,
status: 200,
raw: {
_id: '95ac058c573be9879d059c663',
name: 'premium',
active: true
},
data: {
_id: '95ac058c573be9879d059c663',
name: 'premium',
active: true
},
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 401,
message: 'Unauthorized',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Forbidden',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Not Found',
headers: Object [AxiosHeaders] {}
}
Advanced
This method retrieves a single resource sub-document resource by its identifier with advanced options.
Usage
const response = await services.userService
.id("79c8c567b05e986509d55733a")
.subs("statusHistory")
.readAdvanced('95ac058c573be9879d059c663', { select: ['name'] });
Parameters
Parameter | Type | Description |
---|---|---|
subId | string | The ID of the sub-document resource to be retrieved. |
args | { select?: string[]; populate?: any } (optional) | Advanced arguments for controlling the resource retrieval. |
axiosRequestConfig | AxiosRequestConfig (optional) | Axios request configuration for fine-tuning the HTTP request. |
Response
Prop | Type | Description |
---|---|---|
success | boolean | Indicates whether the request was successful. |
status | number | HTTP status code of the response. |
message | string | A message providing additional information about the response, especially in case of errors. |
raw | object | Raw data received from the server. |
data | object | Raw data received from the server. |
headers | object[AxiosHeaders] | Axios headers associated with the response. |
- 200
- 401
- 403
- 404
{
success: true,
status: 200,
raw: {
_id: '95ac058c573be9879d059c663',
name: 'premium'
},
data: {
_id: '95ac058c573be9879d059c663',
name: 'premium'
},
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 401,
message: 'Unauthorized',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Forbidden',
headers: Object [AxiosHeaders] {}
}
{
success: false,
status: 403,
message: 'Not Found',
headers: Object [AxiosHeaders] {}
}