E
E
Egor2014-11-25 21:06:19
MongoDB
Egor, 2014-11-25 21:06:19

How to get _id mongodb + mongoose ?

Greetings.
Users are in the database. At authorization I write down the user in session.
When requesting, I try to get _id in this way req.session.user._id;
At the same time, I get undefined, although the debugger shows that there is 0.
420ad8de5e0a440aa225b9f9f864a7ac.png
PS For the _id increment, I use mongoose-auto-increment, so Number is there, and not the standard mongodb _id.
Why can't get _id and how to get it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lega, 2014-11-26
@ByKraB

Judging by the picture you have an array there, try req.session.user[0]._id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question