I want to apply filters on joined collection with foreign key.
I have two collections (Accounts and Users), Now I'm doing pagination for list of users.
I want to filter and display only users who have trial account.
Accounts collection is joined via foreign key to the users collections.
Given sample data below.
Accounts:{
"_id":"fsdfjhsdjkfjk345j",
"trialAccount":true
}
// After joined with Account collection
Users: {
" _id": "fhsdf789sdfysdhf",
"name": "John",
"accountId":"fsdfjhsdjkfjk345j",
"account": { // joined collection
"trialAccount": true
}
}
publishPagination(Users,{
name:"usersData"
});
I'm able to display account.trialAccount value in the grid page, but not able to do filters on it.
Giving empty records when i do this.
filters: {
"account.trialAccount":true
}
Can you explain how we can use your package to apply filters on joined content?
Since mongo does not allow searching in a joined collection, there is no way to do a subscription to Users collection and filter by a column in Accounts collection.
There are 2 workarounds:
add the required column in Users collection
create the subscription on Accounts collection, but then you wouldn't be able to filter by columns in Users collection
I want to apply filters on joined collection with foreign key. I have two collections (Accounts and Users), Now I'm doing pagination for list of users. I want to filter and display only users who have trial account. Accounts collection is joined via foreign key to the users collections. Given sample data below.
Accounts:{ "_id":"fsdfjhsdjkfjk345j", "trialAccount":true } // After joined with Account collection Users: { " _id": "fhsdf789sdfysdhf", "name": "John", "accountId":"fsdfjhsdjkfjk345j", "account": { // joined collection "trialAccount": true } }
publishPagination(Users,{
name:"usersData" });
I'm able to display account.trialAccount value in the grid page, but not able to do filters on it. Giving empty records when i do this.
filters: { "account.trialAccount":true }
Can you explain how we can use your package to apply filters on joined content?