[SERVER-25137] aggregation with graph lookup into non-existent collection throws an error Created: 18/Jul/16  Updated: 19/Nov/16  Resolved: 25/Oct/16

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 3.3.11

Type: Bug Priority: Major - P3
Reporter: Asya Kamsky Assignee: Charlie Swanson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-24769 Support $lookup and $graphLookup with... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2016-10-31
Participants:

 Description   

if "from" collection in aggregate $graphLookup stage does not exist, you get error 40106, "errmsg" : "from collection must have a unique _id index"



 Comments   
Comment by Charlie Swanson [ 25/Oct/16 ]

I'm closing this and marking the fixVersion as "3.3.11", since this was actually fixed as fallout of the work in SERVER-24769 which was done for that release. The most recent commit just adds a test to confirm this behavior.

Comment by Githook User [ 25/Oct/16 ]

Author:

{u'username': u'cswanson310', u'name': u'Charlie Swanson', u'email': u'charlie.swanson@mongodb.com'}

Message: SERVER-25137 Ensure $graphLookup succeeds on non-existent collections
Branch: master
https://github.com/mongodb/mongo/commit/6822a010ac581ed5321a40dcfec80b369870dccb

Comment by Asya Kamsky [ 24/Oct/16 ]

Looks like this is fixed in master/3.4 rc:

db.serverBuildInfo()
{
	"version" : "3.4.0-rc0",
	"gitVersion" : "b8a5742ef7623640eb6977f14e25649bad661208",
...
}
db.roads.aggregate({$graphLookup:{from:"points1", connectFromField:"points", connectToField:"_id", as:"details",startWith:"$points"}})
{ "_id" : ObjectId("580e457a87a0572ee623854b"), "points" : [ 1, 4, 7, 9 ], "details" : [ ] }
{ "_id" : ObjectId("580e458187a0572ee623854c"), "points" : [ 2, 3, 5 ], "details" : [ ] }
{ "_id" : ObjectId("580e458987a0572ee623854d"), "points" : [ 5, 6, 8 ], "details" : [ ] }
{ "_id" : ObjectId("580e476687a0572ee623854e"), "points" : [ 9, 1, 4 ], "details" : [ ] }
// points1 collection does not exist

Comment by Ian Whalen (Inactive) [ 25/Jul/16 ]

We don't think this is required for 3.4, but if we happen to fix it while adding support for $graphLookup on views then we'll also resolve this ticket.

Comment by Asya Kamsky [ 18/Jul/16 ]

this happens even if the aggregate command is happening on non-existent collection (which normally just returns nothing).

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