[CSHARP-2606]  error: BSONObj size: 17313886 (0x108305E) is invalid. Size must be between 0 and 16793600(16MB) First element: _id: "" Created: 09/May/19  Updated: 19/Jun/19  Resolved: 19/Jun/19

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Satya A Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Comments   
Comment by Ian Whalen (Inactive) [ 13/May/19 ]

sakthisathya796@gmail.com we suspect that this is a situation with your aggregation pipeline creating an intermediate representation larger than 16MB (which is over the cap of the MongoDB server). Can you please check how large you would expect the "topics" set to get given your data?

Comment by Satya A [ 09/May/19 ]

My Code

 

Model.aggregate([
{
"$lookup":

{ "from": "Subject", "localField": "subject", "foreignField": "_id", "as": "subject" }

},
{$unwind: {path: "$subject"}},
{$unwind: {path: "$topics"}},
{
"$lookup":

{ "from": "Topic", "localField": "topics._id", "foreignField": "topics._id", "as": "topic" }

},
{$group: {_id: "$subject", topics: {$addToSet: { topic: '$topics', course: "$topic"}}}},
{$group: {_id: "", data: {$addToSet: {"topics": "$topics", "subject":"$_id","_id": "$_id._id"}}}},

{
$project:

{ subject: "$data" }

},
]

Generated at Wed Feb 07 21:43:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.