[SERVER-14144] Aggregation cursor error message shouldn't swallow Runner error Created: 03/Jun/14  Updated: 11/Jul/16  Resolved: 05/Jun/14

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: 2.6.0
Fix Version/s: 2.7.2

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: J Rassi
Resolution: Done Votes: 0
Labels: 28qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-13715 Aggregation pipeline execution can fa... Closed
Operating System: ALL
Steps To Reproduce:

var coll = db.getSiblingDB('newdb').agg;
coll.drop();
coll.ensureIndex({comments: "text"});
 
coll.aggregate([{$match: {$or: [{$text: {$search: 'bar'}}, {foo:1}] }}, {$sort: {foo: 1}}]);

Participants:

 Description   

Similar to SERVER-13715, aggregate() fails with an "exception: cursor encountered an error" message when combining $or, $text, and a blocking sort:

> var coll = db.getSiblingDB('newdb').agg;
> coll.drop();
false
> coll.ensureIndex({comments: "text"});
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
 
> coll.aggregate([{$match: {$or: [{$text: {$search: 'bar'}}, {foo:1}] }}, {$sort: {foo: 1}}]);
assert: command failed: {
	"errmsg" : "exception: cursor encountered an error",
	"code" : 17285,
	"ok" : 0
} : aggregate failed
 


Version: 2.6.2-rc0



 Comments   
Comment by Githook User [ 05/Jun/14 ]

Author:

{u'username': u'jrassi', u'name': u'Jason Rassi', u'email': u'rassi@10gen.com'}

Message: SERVER-14144 Aggregation cursor error shouldn't swallow Runner error
Branch: master
https://github.com/mongodb/mongo/commit/693b5368a978a9e05017cd7e40f56dfac1ba243c

Comment by Kamran K. [ 03/Jun/14 ]

I get a runner error with the same $text query outside of the aggregation framework. The aggregation error message is a bit unhelpful, but the underlying $or limitation is known and documented: http://docs.mongodb.org/manual/reference/operator/query/text/#restrictions

> var coll = db.getSiblingDB('newdb').agg;
> coll.drop();
true
> coll.ensureIndex({comments: "text"});
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> coll.find({$or: [{$text: {$search: 'bar'}}, {foo:1}] })
error: {
	"$err" : "Runner error: BadValue error processing query: ns=newdb.agg limit=0 skip=0\nTree: $or\n    foo == 1.0\n    TEXT : query=bar, language=, tag=NULL\nSort: {}\nProj: {}\n planner returned error: Failed to produce a solution for TEXT under OR - other non-TEXT clauses under OR have to be indexed as well.",
	"code" : 17144
}

Generated at Thu Feb 08 03:33:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.