When I use findById on my model, it returns all fields except the one that references another document.
This is the document on the database (MongoDB Document):
{
_id: ObjectId("62791a34bfdd286f0d9105b7"),
title: 'yes!',
path: 'public/uploads/birds-1.mp4',
author: {
_id: ObjectId("6276b73f1793107c9027a8ee"),
name: -,
email: -,
image: -,
emailVerified: null,
},
}
And this is what I'm getting when using findById (doesn't return the author field):
{
_id: new ObjectId("62791a34bfdd286f0d9105b7"),
title: 'yes!',
path: 'public/uploads/birds-1.mp4'
}
Videos Schema:
mongoose.Schema({
title: {
type: String,
required: true,
},
path: {
type: String,
required: true,
},
author: {
type: mongoose.Schema.Types.ObjectId,
ref: "User",
},
})