Post.tagTest = function(cb) {
Post.find({
where : {
id: 428 //sample item that has multiple tags, one with trash:true and one with trash:false
},
include: {
relation: "tags",
scope: {
where: {
trash: false
}
}
}
}, function(err, res) {
cb(null, res);
});
}
Post.remoteMethod('tagTest', {
http : {verb : 'get' },
returns: [{arg: 'data', type: 'array'}]
});{
"name": "Post",
"plural": "posts",
"base": "PersistedModel",
"options": {
"idInjection": false,
"mysql": {
"table": "posts"
},
"relations": {
"tags": {
"type": "hasMany",
"model": "Tag",
"foreignKey": "postId",
"through": "Tag_Post"
}
}
}
}
--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
include: {
relation: "tags",
where: {
trash: false
}
}scope: {
where: {
trash: false
}
}...
include: {
relation: "tags",
scope: { where: {
trash: false
} }
}
include: {
relation: "tags",
scope: {
relation: "tag",
scope: {
where: {
trash: false
}
}
}
} "dependencies": {
"compression": "^1.0.3",
"errorhandler": "^1.1.1",
- "loopback": "^2.8.0",
- "loopback-boot": "^2.4.0",
- "loopback-connector-mongodb": "^1.6.0",
- "loopback-datasource-juggler": "^2.7.0",
+ "loopback": "^2.15.0",
+ "loopback-boot": "^2.6.5",
+ "loopback-connector-mongodb": "^1.8.0",
+ "loopback-datasource-juggler": "^2.23.0",
"serve-favicon": "^2.0.1"
},
"optionalDependencies": {
- "loopback-explorer": "^1.1.0"
+ "loopback-explorer": "^1.7.2"
},
var query = { "where": { "id": this.teamId }, "include": { "relation": "players", "scope": { "where": { "hasLeft": false, "dateTransfer": { "lt": fixedDate } } } }}; Team.find(query, function(err, team){ //also tried with .findOne( ..."players": { "type": "hasMany", "model": "player", "foreignKey": "teamId", "through": "transfer"}{ "name": "transfer", "plural": "transfers", "base": "PersistedModel", "idInjection": true, "properties": { "dateTransfer": { "type": "date" }, "hasLeft": { "type": "boolean" } }, "validations": [], "relations": { "team": { "type": "belongsTo", "model": "team", "foreignKey": "" }, "player": { "type": "belongsTo", "model": "player", "foreignKey": "" } }, "acls": [ { "accessType": "*", "principalType": "ROLE", "principalId": "$everyone", "permission": "DENY" }, { "accessType": "*", "principalType": "ROLE", "principalId": "$authenticated", "permission": "ALLOW" } ], "methods": []}...
Picture.find({filter:{
"include": {
"relation": "user",
"scope": {
where: { 'user.id': 122}
}
}
}},function success(data){
$scope.pictures = data;
});
Picture.find( {
filter:{
"include": {
"relation": "user",
"scope": {}
}
}
,
where: {
"user.id":122
}},function success(data){
$scope.pictures = data;
});
--
You received this message because you are subscribed to a topic in the Google Groups "LoopbackJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/loopbackjs/FU7PAkW7VOc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/46029b22-9702-459d-9fad-eb3520a19fed%40googlegroups.com.