[DOCS-10259] text search in aggregation limitation says that it cannot be used inside "$or", but it looks like you can. Created: 15/May/17  Updated: 30/Oct/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Michael O'Brien Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769

 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)



 Comments   
Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 08:00:09 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.