Created
May 29, 2017 12:21
-
-
Save dclarke-modus/9403567d7285531e762908d2038b2d4a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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