#Having trouble combining geospatial & non-geospatial queries in an AND array

1 messages · Page 1 of 1 (latest)

candid wind
#

I'm getting
MongoServerError: $geoNear, $near, and $nearSphere are not allowed in this context

while trying to query by location and some other fields at the same time. Any ideas what might be causing this?

My query (before qs.stringify())
{
and: [
//ourselves
{id: {
not_equals: options.userTeam.id
}},
//teams we've already matched with
//teams we've declined
//teams that have declined us.
//teams that have already matched with us
{id: {
not_in: teamIDsToIgnore
}},
//teams outside of our radius
{location: {
near: [
options.userTeam.location[0],
options.userTeam.location[1],
1000*options.radius,
0
]
}}
]
}

serene moonBOT
candid wind
#

Geospatial on it's own seems to work ok

#

However when added to an and:[] block in a where:{...} query, it gives me the not allowed in context error

#

Even if there's nothing else in the and block

#

As far as I can see in the docs there's nothing that hints that that's not possible, but might be missing something