title: How to increase BSON limit Size
body: <p>I am rewrite the aggregation code for 100k records in my collection &quot;auctions&quot; and i need to create function for the reference of another stack overflow guide</p>
  <p><a href="https://stackoverflow.com/questions/36233478/how-to-increase-mongodb-bson-document-size">How to increase mongodb BSON document size</a></p>
  <p>but getting error for the</p>
  <pre><code>error TS2559: Type '(err: any, auctions: any) =&gt; void' has no properties in common with type 'CollectionCreateOptions' 
  </code></pre>
  <p>how to get 100k records in BSON limit of more then 16MB in mongoDB</p>
  <p>my code</p>
  <pre><code>db.collection(&quot;auctions&quot;,   (err: any, auctions: any): any =&gt; {
                      if(err) throw err;
                      const result: any = [];
  
                      const cursor: any = auctions.aggregate(
                          [
                              {
                                  $match: {
                                      status: 'UNPAID'
                                  }
                              },
                              {
                                  $lookup: {
                                      from: 'bids',
                                      let: { id: '$_id' },
                                      pipeline: [
                                          {
                                              $match: {
                                                  $expr: { $and: [{ $eq: ['$auctioncode', '$$id'] }] },
                                              },
                                          },
                                      ],
                                      as: 'bids',
                                  },
                              },
                              {
                                  $facet: {
                                      products: [{ $skip: 0 }, { $limit: 100000 }],
                                  },
                              }
                          ],
                          {
                              &quot;allowDiskUse&quot;: true,
                              &quot;cursor&quot;: { &quot;batchSize&quot;: 20 }
                          }
                      );
  
  
                      cursor.on(&quot;data&quot;,(data: any) =&gt; {
                          result.push(data);
                      });
  
                      cursor.on(&quot;end&quot;,() =&gt; {
                        return result;
                      })
                  })
  </code></pre>