My goal is to accomplish the following:
async fetchTrack(id, type: String) : Promise<Track[]> {
const query = this.trackModel.find(
{ type : id },
{_id:0}
).limit(100);
return query;
}
I am attempting to dynamically replace the property "type" with the string provided in the function at runtime within the query. Any suggestions on how I can achieve this?
I have already researched online and attempted to cast it, but without success.