Type 'string' is not assignable to type 'UserDoc | QuerySelector<UserDoc> | undefined'

Viewed 216

I have an Area Document

// An interface that descripbe the properties
// that a Area document has
interface AreaDoc extends mongoose.Document {
  code: string;
  description: string;
  isActive: boolean;
  createdBy: UserDoc;
  createdAt: Date;
  modifiedAt: Date;
}

Trying to use createdBy (interface UserDoc extends mongoose.Document) to find an area.

enter image description here

I know that this issue is because the const createdBy = req.currentUser!.id; returns a string value.

Any idea how i can resolve this

0 Answers
Related