Skip to content

Mongoose #5

@farmanalibhatti

Description

@farmanalibhatti
//get user Profile
  public getUserProfile = async (user_id: string): Promise<any> => {
    console.log("Validity =====>", Mongoose.Types.ObjectId.isValid(user_id));
    const data = await Profile.findOne({ user: Mongoose.Types.ObjectId.createFromHexString(user_id) });
    return data;
  };

In this service, I am unable to map proper type. Can you please help me with that?
I am getting error below:

Type 'ObjectId' is not assignable to type 'Condition<{ type: ObjectId; }>'.
  Type 'ObjectId' has no properties in common with type 'QuerySelector<{ type: ObjectId; }>'.

This is an object id of user that I am trying to access in profile model.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions