Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-43313

bsonobj size is invalid because size is greater than 16mb

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • ALL

    Description

      I have a collection called Students which contain 515410 records of documents. i created a query for search and with limited dataset its working fine but with large dataset its failing and throw error (bsonobj size: is invalid. size must be between 0 and 16793600(16mb)).
      Please help me to understand and let me know how can i handle this error.

      Document screenshot attached please have a look and below is my mongo query for search.

       
      student
            .aggregate([
              

      {          $match: matchByFilterSet         }

      ,
              {
                $facet: {
                  task1: [
                    {
                      $group: 

      {                   _id: null,                   emailIds:\{$push: "$Email"}

      ,
                        count: 

      {                     $sum: 1                   }

      ,
                        overallScholarshipGrantedCount:{
                          $sum: 

      {                       $size: "$scholarshipHistory.ReceivedScholarships"                     }

                        },                  
                        scholarshipsGrantCount: {
                          $sum: {
                            $cond: [
                              {
                                $gte: [
                                  

      {                               $size: "$scholarshipHistory.ReceivedScholarships"                             }

      ,
                                  1
                                ]
                              },
                              //{ $in: [ "$scholarshipHistory.ReceivedScholarships", [] ] }
                              1,
                              0
                            ]
                          }
                        },
                        profileCompletedCount: {
                          $sum: 

      {                       $cond: [\{ $eq: ["$isProfileCompleted", true] }

      , 1, 0]
                          }
                        },
                        statusApprovedCount: {
                          $sum: 

      {                       $cond: [\{ $eq: ["$status", "Approved"] }

      , 1, 0]
                          }
                        },
                        statusPendingCount: {
                          $sum: 

      {                       $cond: [\{ $eq: ["$status", "Pending"] }

      , 1, 0]
                          }
                        },
                        statusRejectCount: {
                          $sum: 

      {                       $cond: [\{ $eq: ["$status", "Reject"] }

      , 1, 0]
                          }
                        }
                      }
                    }
                  ],
                  task2: [
                    {
                      $sort: 

      {                   updatedOn: -1                 }

                    },
                    

      {                 $skip: offset               }

      ,
                    

      {                 $limit: limit               }

                  ]
                }
              },
              

      {           $unwind: "$task1"         }

      ,
              {
                $project: 

      {             total_students: "$task1.count",             scholarshipsGrantCount: "$task1.scholarshipsGrantCount",             overallScholarshipGrantedCount:"$task1.overallScholarshipGrantedCount",             profileCompletedCount: "$task1.profileCompletedCount",             emailIds:"$task1.emailIds",             dataList: "$task2",             statusApprovedCount: "$task1.statusApprovedCount",             statusPendingCount: "$task1.statusPendingCount",             statusRejectCount: "$task1.statusRejectCount"           }

              }
            ])
            .exec();

      Attachments

        Activity

          People

            carl.champain@mongodb.com Carl Champain (Inactive)
            vineysharma1102@gmail.com viney sharma
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: