var mongoose = require('mongoose'); var Schema = mongoose.Schema; module.exports.schema = new Schema({ email: {type: String}, emailConfirmed: {type: Boolean, default: false}, emailPin: {type: String}, password: {type: String}, isAdmin: {type: Boolean, default: false}, cart: {type: Schema.Types.ObjectId, ref: 'Cart'}, purchases: [{type: Schema.Types.ObjectId, ref: 'Cart'}], credit: {type: Number, default: 0},//Credit in cents because non-integers are confusing? savedAddress: {type: String}, lastLogin: {type: Number, required: true} }, { usePushEach: true }); module.exports.model = mongoose.model('User', module.exports.schema);