Reputation: 747
I want to find out how many of my students are being taught by a specific teacher. However some of the students have multiple teachers. The value of the teacher_name
entry is represented as an array. The following query only shows those results where the match is exact, that is, it won't show me results where there are multiple teachers.
r.db('client').table('basic_info').filter({teacher_name: ["Andrew McSwain"]});
How can I iterate through the arrays to match if it contains the string I specified? Is there an API command for this or can I use good-ole javascript methods?
Upvotes: 1
Views: 809
Reputation: 5289
You probably want something like:
r.db('client').table('basic_info').filter(function(row) {
return row('teacher_name').contains('Andrew McSwain');
})
Upvotes: 2