0 votes
1 view
in Web Technology by (28.7k points)

I am writing a NodeJS server with ExpressJS, PassportJS, MongoDB, and MongooseJS. I just managed to get PassportJS to use user data obtained via Mongoose to authenticate.

But to make it work, I had to use a "findById" function like below.

var UserModel = db.model('User',UserSchema);

UserModel.findById(id, function (err, user) { < SOME CODE > } );

UserModel is a Mongoose model. I declare the schema, UserSchema earlier. So I suppose UserModel.findById() is a method of the Mongoose model?

Question

What does findById do and is there documentation on it? I googled around a bit but didn't find anything.

Please log in or register to answer this question.

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...