Problem
Hey. I have something that seems like a strange problem to me, and am in difficulty with this:
Letβs take:
tags = [ ObjectId('a'), ObjectId('b') ] search = { $search: 'abc' }
Now the following query works fine:
db.entries.find({ $or: [ {$text:search} ] })
And this too:
db.entries.find({ $or: [ {tags:{$in:tags}} ] })
But combine them:
db.entries.find({ $or: [ {$text:search}, {tags:{$in:tags}} ] })
And I get the following error:
Unable to execute query: error processing query: ns=db.entries Tree: $or tags $in [ ObjectId('a'), ObjectId('b') ] TEXT : query=abc, language=, tag=NULL Sort: {} Proj: {} No query solutions
Meta data
- I am using MongoDB version
2.6.4 . - Combining any of the conditions with a simple expression
{_id:"c"} works fine. - I really have my text indexes set.
- The order in which conditions appear in
$or -array does not affect the result.
My question
Help?: (
javascript search mongodb
Avaq
source share