loopback-objectid-mixin
Version:
Sets objectId type for model property
60 lines (43 loc) • 1.2 kB
Markdown
This module is designed for the [Strongloop Loopback](https://github.com/strongloop/loopback) framework. It sets objectId type for model properties.
```bash
npm install --save loopback-objectid-mixin
```
Add the `mixins` property to your `server/model-config.json` like the following:
```json
{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"../node_modules/loopback-objectid-mixin",
"../common/mixins"
]
}
}
```
To use with your Models add the `mixins` attribute to the definition object of your model config.
```json
{
"name": "Product",
"properties": {},
"mixins": {
"ObjectidType": {
"properties": ["userId"]
}
}
}
```
**options**
| option | type | description | required |
| ------ | ---- | ----------- | -------- |
|properties| [String] | properties which you want to set objectId type | true |