Reputation: 3962
I'm using Node
, Passport
, LocalStrategy
, Mongoose
for one simple project, and have 2 questions...
user
element returned by UserModel.findOne(...)
has the members I expect it has: { _id, local, facebook, google, twitter, createdAt, updatedAt }
, but all these members are also (duplicated) inside its member: _doc
?when I expand the _doc
member, I get:
user
?Could you clarify these 2 questions for me?
Thanks!
Upvotes: 1
Views: 401
Reputation: 6403
_doc
is the raw js object.
user
is the mongoose Document, that inherits javascript Object
.
Mongoose provides a lot of different APIs, that are included in the Document object.
While _doc
will just have the APIs that a normal javascript object offers.
Upvotes: 1