Am facing the casterror in my mongoose. I am sorry to ask this question again, but am unable to figure out my mistake. I am able to view the results through postman. But, I can't display the tasks on my frontend. When I am trying get the data from api to the frontend with TaskService am unable to fetch the data.
app.js
app.get('/lists/:listId/task',(req,res)=>{
    Task.find({
        _listId:req.params.listId
    }).then((task)=>{
        res.send(task);
    })
})
app.post('/lists/:listId/task',(req,res)=>{
    let newTask=new Task({
        title:req.body.title,
        _listId:req.params.listId
    });
    newTask.save().then((result)=>{
        res.send(result);
    })
})
app.patch('/lists/:listId/task/:taskId',(req,res)=>{
    Task.findOneAndUpdate({
        _listId:req.params.listId,
        _id:req.params.taskId
    },{$set:req.body})
    .then(()=>{
        res.sendStatus(200);
    })
});
app.delete('/lists/:listId/task/:taskId',(req,res)=>{
    Task.findOneAndRemove({
        _id:req.params.taskId,
        _listId:req.params.listId
    }).then((result)=>{
        res.send(result);
    })
})
config.ts
    export const baseURL=environment.production?'https://api.taskmanager.com':'http://localhost:3000';
    export const listURL=baseURL+'/lists';
    export const taskURL=baseURL+'/lists/:listId/task';
task.model.ts 
const taskSchema=new mongoose.Schema({
    title:{
        type:String,
        required:true
    },
    _listId:{
        type:mongoose.Types.ObjectId,
        required:true
    },
});
const Task=mongoose.model('Task',taskSchema);
module.exports=Task;
task.model.ts (In frontend)
export class Task{
    title:String;
    _listId:number;
    constructor(title:String,Id:number){
        this.title=title;
        this._listId=Id;
    }
}
task.service.ts
    export class TaskServiceService {
        
          constructor(private http:HttpClient) { }
        
     getTasks(id:string):Observable<Task[]>{
    let taskURL=`${baseURL}/lists/${id}/task`;
    return this.http.get<Task[]>(taskURL);
  }
      }
task-view.component.ts
ngOnInit(){
    this.getList();
    this.route.params.subscribe((params:Params)=>{
      console.log(params);
      this.taskService.getTasks(params.lisId).subscribe((tasks)=>{
        this.tasks=tasks;
      })
    });
  }
 
     
    