Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dclarke-modus/feb44eb972c4c1cbc6d91efb3953a029 to your computer and use it in GitHub Desktop.
Save dclarke-modus/feb44eb972c4c1cbc6d91efb3953a029 to your computer and use it in GitHub Desktop.
//Client Model
module.exports = {
connection: "mongodbServer",
attributes: {
url: {
type: 'string',
required: true
},
clientid: {
type: 'string',
required: true
},
// e.g., "cm"
clientpassword: {
type: 'string',
required: true
},
email:{
type:'string', required:true
},
scopes: {
collection:"scope",
via: "owner"
}
}
}
//Scope model
module.exports = {
connection: "mongodbServer",
attributes: {
controller : { type: 'string' },
method : { type: 'string' },
owner: {
model: "client"
}
}
};
//MY QUERY
Client.findOne({clientid:decoded.clientid, scopes:{controller:controller, method:method}}).exec(function(err,client) .....
Client in this case is always null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment