So I'm using passport.js authentication and storing several subdocuments that are relevant to my User model:
var UserSchema = new Schema({
fullName: {
type: String,
trim: true,
default: ''
},
actions: [{
title: String,
step: Number,
addIf: [String],
added: { type: Date, default: Date.now }
}]
});
I'm new to passport, but curious to know how I can configure it to provide only a part of this User Model during the log in process, akin to:
User.findOne({
_id: id
}, '-actions', function(err, user) {
// get user object
});
Where is the best place to add this middleware?
Aucun commentaire:
Enregistrer un commentaire