Mongoose supports virtual attributes. Virtual attributes are attributesthat are convenient to have around but that do not get persisted to mongodb. When we have m:1, m:n relationship, we may need to fetch all related data. For example; we have User and Portfolio schemas and Portfolio has user ID as foreign key. Let’s suppose when we …