These are chat archives for Automattic/mongoose

15th
Oct 2015
Alex Hatzipanis
@hatzipanis
Oct 15 2015 03:51 UTC

Hi all. I've been stuck on a problem for the last few hours. I'm using the query builder to build a bit of a filter. This works: q.where({ 'organisation.categories.npo': {$in: locals.filters.npo}}) but I want to use a logical OR to build up results from different categories. If I try this:

q.or([
    { 'organisation.categories.npo': { $in: locals.filters.npo }}, 
    { 'organisation.categories.business': { $in: locals.filters.business }}
    ])

I get undefined. Can anyone spot what I'm doing wrong?

Alex Hatzipanis
@hatzipanis
Oct 15 2015 07:29 UTC
Never mind, I eventually got there. It turned out sometimes it was looking in a variable like locals.filters.npo which wasn't an array.