Details
-
Improvement
-
Resolution: Won't Do
-
Major - P3
-
None
-
None
Description
From https://docs.mongodb.com/manual/tutorial/text-search-in-aggregation/#restrictions
It says "The text operator expression cannot appear in $or or $not expressions."
However I just tried this and surprisingly, it seems to work:
> db.articles.aggregate( [ { $match: {"$or":[{ $text: { $search: "cake" } },{"_id":ObjectId("591a0db04b8a0358aec1e104")}] }} ] )
|
{ "_id" : ObjectId("591a0db04b8a0358aec1e104"), "x" : "cake" }
|
On the other hand, using it with $nor does not seem to be allowed (though the docs don't say so)