showing results for - "role schema in mongoose"
Diego Alejandro
06 Aug 2019
1    var UserSchema = new Schema({
2    firstName: {
3        type: String,
4        trim: true,
5        default: '',
6        validate: [validateLocalStrategyProperty, 'Please fill in your first name']
7    },
8    lastName: {
9        type: String,
10        trim: true,
11        default: '',
12        validate: [validateLocalStrategyProperty, 'Please fill in your last name']
13    },
14    displayName: {
15        type: String,
16        trim: true
17    },
18    email: {
19        type: String,
20        trim: true,
21        default: '',
22        validate: [validateLocalStrategyProperty, 'Please fill in your email'],
23        match: [/.+\@.+\..+/, 'Please fill a valid email address']
24    },
25    username: {
26        type: String,
27        unique: 'testing error message',
28        required: 'Please fill in a username',
29        trim: true
30    },
31    password: {
32        type: String,
33        default: '',
34        validate: [validateLocalStrategyPassword, 'Password should be longer']
35    },
36    salt: {
37        type: String
38    },
39    provider: {
40        type: String,
41        required: 'Provider is required'
42    },
43    providerData: {},
44    additionalProvidersData: {},
45    roles: {
46        type: [{
47            type: String,
48            enum: ['user', 'admin']
49        }],
50        default: ['user']
51    },
52    updated: {
53        type: Date
54    },
55    created: {
56        type: Date,
57        default: Date.now
58    },
59    /* For reset password */
60    resetPasswordToken: {
61        type: String
62    },
63    resetPasswordExpires: {
64        type: Date
65    }
66});
67
similar questions
queries leading to this page
role schema in mongoose