Last active
November 16, 2017 12:25
-
-
Save dclarke-modus/08e8f323ba8180f1953783a743830578 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
*Code to save Client and Scope:* | |
```javascript | |
let scope = new ScopeModel(); | |
scope.client = client._id; | |
scope.markModified('client'); | |
console.log(scope); | |
await scope.save(); | |
``` | |
*What's in the DB after save* | |
_id:5a0d80d892a84d0e4d144d45 | |
__v:0 | |
*My Scope Schema Model:* | |
import mongoose from 'mongoose'; | |
let Schema = mongoose.Schema; | |
var ScopeSchema = Schema({ | |
client: [{ type: Schema.Types.ObjectId, ref: 'Client' }], | |
service: [{ type: Schema.Types.ObjectId, ref: 'Service' }], | |
grant: [{ type: Schema.Types.ObjectId, ref: 'Grant' }] | |
}); | |
export default ScopeSchema; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment