My database is something like this
“status”: “todo”,
“author”: {
“username”: “henro92”,
“email”: "henry.unah@rocketmail.com",
“id”: “5a8aeb6b687d1b041471e4cc”
},
“source”: {
“username”: “h82”,
“email”: "henry.unah@gmail.com",
“id”: “5a71cb7637b4492704006e47”,
“firstname”: “Henry”,
“lastname”: “Jordan”,
“sex”: " Male ",
“dateOfBirth”: “2018-01-31”
}
I want to get find the data by the source which is an object like this and it doesn’t work
this.questionnaireresponseapi.findOne({
where: {
source:
this.loopbackauth.getCurrentUserData().user
}
})
when I try with the status which is a string it works
this.questionnaireresponseapi.findOne({
where: {
source: this.loopbackauth.getCurrentUserData().user
}
})
Any idea on how I can solve this problem?
I solved the problem using source.id this.questionnaireresponseapi.findOne({where: {'source.id': this.loopbackauth.getCurrentUserId()}}).subscribe((data)=>{ this.thequestionnaireResponse = data;
}