Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *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;
Add Comment
Please, Sign In to add comment