You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But I am unable to filter by a second-level property which has nested data.
I tried the below it but doesn't seem to be working Customer.find({ include: ["jobs"],where :{"jobs.JobTypes":"Plumbing"} }, function(err, data) { console.log(data); cb(null, true, data); });
I have tried this as well. Customer.find({ include: ["jobs"],where :{"jobs":{"JobTypes":"Plumbing"}} }, function(err, data) { console.log(data); cb(null, true, data); });
This is the json I am trying to Filter { [ { "customer_id": 1, "customer_name": "1", "realm": "string", "username": "mel", "email": "[email protected]", "emailVerified": false, "id": "5d88ac24a823fa5504b2db1f", "jobs": [ { "jobId": 1, "CustomerId": 1, "jobType": "Painting", "id": "5d88c4670f527a484c57b09d" }, { "jobId": 2, "CustomerId": 1, "jobType": "Plumbing", "id": "5d88c47f0f527a484c57b09e" }, { "jobId": 3, "CustomerId": 1, "jobType": "Dancing", "id": "5d88c4920f527a484c57b09f" } ]
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Customer hasMany relationship with jobs
Filtering by the top-level property works as shown below
Customer.find({ include: ["jobs"],where :{username:"mel"} }, function(err, data) {
console.log(data);
cb(null, true, data);
});
But I am unable to filter by a second-level property which has nested data.
I tried the below it but doesn't seem to be working
Customer.find({ include: ["jobs"],where :{"jobs.JobTypes":"Plumbing"} }, function(err, data) {
console.log(data);
cb(null, true, data);
});
I have tried this as well.
Customer.find({ include: ["jobs"],where :{"jobs":{"JobTypes":"Plumbing"}} }, function(err, data) {
console.log(data);
cb(null, true, data);
});
This is the json I am trying to Filter
{ [ { "customer_id": 1, "customer_name": "1", "realm": "string", "username": "mel", "email": "[email protected]", "emailVerified": false, "id": "5d88ac24a823fa5504b2db1f", "jobs": [ { "jobId": 1, "CustomerId": 1, "jobType": "Painting", "id": "5d88c4670f527a484c57b09d" }, { "jobId": 2, "CustomerId": 1, "jobType": "Plumbing", "id": "5d88c47f0f527a484c57b09e" }, { "jobId": 3, "CustomerId": 1, "jobType": "Dancing", "id": "5d88c4920f527a484c57b09f" } ]
The text was updated successfully, but these errors were encountered: