controller
my data schema is like this:
"educationalrequests": [
{
"title": "some title",
"body": "some text",
"user": {
"_id": "5b3e5fe9448e0406e65e5169",
"username": "peter",
"role": {
"name": "Student"
}
}
}
now how can i return only requests with "user._id" = "authorizedUser._id" ?
also i need to check if the "user.role.name" is "Student"
how should i change this code ?
// in my controller's service
return Educationalrequest
.find()
.where(filters.where)
.sort(filters.sort)
.skip(filters.start)
.limit(filters.limit)
.populate(populate);
Please format the code you posted, by wrapping it in triple backticks. -> `
Change the filters?
Обсуждают сегодня