Comments (4)
Hello, it should work if you followed the steps, which are pretty much the same as other plugins.
Please paste your model json and your model-config.json, maybe I can find something weird.
from loopback-mongo-distinct-mixin.
Model: post.json:
{ "name": "post", "base": "PersistedModel", "idInjection": true, "options": { "validateUpsert": true }, "forceId": false, "mixins": { "ObjectidType": { "properties": [ "postId" ] }, "Distinct": true, "Rediscache": {}, "Versioning": true }, "properties": { "name": { "type": "string", "required": true }, "subtitle": { "type": "string" }, "smallDescription": { "type": "string" }, "description": { "type": "string" }, "metaTitle": { "type": "string" }, "metaDescription": { "type": "string" }, "redirectUrl": { "type": "string" }, "trackingUrl": { "type": "string" }, "innerTrackingUrl": { "type": "string" }, "postId": { "type": "string" }, "itemDate": { "type": "date" }, "active": { "type": "boolean", "default": false }, "timeActive": { "type": "boolean", "default": false }, "slug": { "type": "string", "required": true }, "slugActive": { "type": "boolean", "default": true }, "tags": { "type": "array" }, "categories": { "type": "array" }, "authors": { "type": "array" }, "attributes": { "type": "array" }, "type": { "type": "string" }, "continent": { "type": "array" }, "country": { "type": "array" }, "city": { "type": "array" }, "source": { "type": "string" }, "sourceUrl": { "type": "string" }, "interviewee": { "type": "string" }, "gallery": { "type": "array" }, "videoUrl": { "type": "string" }, "videoEmbed": { "type": "string" }, "relItems": { "type": "array" }, "mainPhoto": { "type": "Object" }, "secondaryPhoto": { "type": "Object" }, "lang": { "type": "string", "required": true }, "hits": { "type": "number", "default": 0 }, "createdBy": { "type": "string" }, "updatedBy": { "type": "string" }, "created": { "type": "date" }, "lastUpdated": { "type": "date" } }, "validations": [], "relations": { "createdByUser": { "type": "belongsTo", "model": "user", "foreignKey": "createdBy" }, "updatedByUser": { "type": "belongsTo", "model": "user", "foreignKey": "updatedBy" }, "lists": { "type": "hasMany", "model": "list", "foreignKey": "itemId", "through": "listitem" }, "categoriesList": { "type": "referencesMany", "model": "category", "foreignKey": "categories", "options": { "validate": true, "forceId": false } }, "authorsList": { "type": "referencesMany", "model": "author", "foreignKey": "authors", "options": { "validate": true, "forceId": false } }, "tagsList": { "type": "referencesMany", "model": "tag", "foreignKey": "tags", "options": { "validate": true, "forceId": false } } }, "acls": [ { "accessType": "*", "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY" }, { "accessType": "READ", "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" }, { "accessType": "*", "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" } ], "methods": { "getPost": { "accepts": { "arg": "filter", "type": "string", "http": { "source": "query" } }, "returns": { "arg": "data", "type": "Post" }, "http": { "verb": "get" } } } }
model-config.json:
`{
"_meta": {
"sources": [
"loopback/common/models",
"loopback/server/models",
"../common/models",
"./models"
],
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../node_modules/loopback-mongo-distinct-mixin",
"../common/mixins",
"./mixins",
"../node_modules/loopback-objectid-mixin"
]
},
"user": {
"dataSource": "ypsilondb",
"public": true
},
"AccessToken": {
"dataSource": "ypsilondb",
"public": true,
"relations": {
"user": {
"type": "belongsTo",
"model": "user",
"foreignKey": "userId"
}
}
},
"ACL": {
"dataSource": "ypsilondb",
"public": false
},
"RoleMapping": {
"dataSource": "ypsilondb",
"public": true,
"options": {
"strictObjectIDCoercion": true
}
},
"Role": {
"dataSource": "ypsilondb",
"public": true
},
"content": {
"dataSource": "ypsilondb",
"public": true
},
"container": {
"dataSource": "myStorageDataSource",
"public": true
},
"sfile": {
"dataSource": "ypsilondb",
"public": true
},
"language": {
"dataSource": "ypsilondb",
"public": true
},
"websetting": {
"dataSource": "ypsilondb",
"public": true
},
"page": {
"dataSource": "ypsilondb",
"public": true
},
"post": {
"dataSource": "ypsilondb",
"public": true
},
"category": {
"dataSource": "ypsilondb",
"public": true
},
"tag": {
"dataSource": "ypsilondb",
"public": true
},
"list": {
"dataSource": "ypsilondb",
"public": true
},
"listitem": {
"dataSource": "ypsilondb",
"public": true
},
"attribute": {
"dataSource": "ypsilondb",
"public": true
},
"menu": {
"dataSource": "ypsilondb",
"public": true
},
"imagesetting": {
"dataSource": "ypsilondb",
"public": true
},
"version": {
"dataSource": "ypsilondb",
"public": true
},
"author": {
"dataSource": "ypsilondb",
"public": true
},
"useronline": {
"dataSource": "ypsilondb",
"public": true
},
"slider": {
"dataSource": "ypsilondb",
"public": true
}
}
`
from loopback-mongo-distinct-mixin.
Problem is in the mixin include path:
"mixins": [
"loopback/common/mixins",
"loopback/server/mixins",
"../node_modules/loopback-mongo-distinct-mixin",
"../common/mixins",
"./mixins",
"../node_modules/loopback-objectid-mixin"
]
}
It should be:
"../node_modules/loopback-mongo-distinct-mixin/lib"
from loopback-mongo-distinct-mixin.
The correct path is:
"../node_modules/@aliatech/loopback-mongo-distinct-mixin/lib"
I've just updated the docs, sorry for the inconvenience
from loopback-mongo-distinct-mixin.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loopback-mongo-distinct-mixin.