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

Aggregation command returning a document close to the maximum size fails.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.5.3
    • Fix Version/s: 2.5.4
    • Component/s: Aggregation Framework
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      The session below shows how to create a document that is close to the maximum size and then retrieve it with an aggregation command (using a cursor) and with a findOne(). The aggregation fails.

      MongoDB shell version: 2.5.3
      connecting to: test
      Server has startup warnings: 
      2013-11-03T19:16:05.526-0500 [initandlisten] 
      2013-11-03T19:16:05.526-0500 [initandlisten] ** NOTE: This is a development version (2.5.3) of MongoDB.
      2013-11-03T19:16:05.526-0500 [initandlisten] **       Not recommended for production.
      2013-11-03T19:16:05.526-0500 [initandlisten] 
      // As big a document as we can make.
      > var bytes=(16 * 1024 * 1024) - (4 + 6 + 5);
      // ... using one large hex string.
      > var hex=""
      > for ( var i = 0; i < bytes; ++i ) { hex=hex+"00"; } ; db.test.insert( { "_id" : HexData( 0, hex ) } )
      > db.test.find({}, { _id : 0 } )
      {  }
      > db.test.aggregate( { $match : {} } )
      assert: command failed: {
      	"errmsg" : "exception: Tried to create string longer than 16MB",
      	"code" : 16493,
      	"ok" : 0
      } : aggregate with cursor failed
      Error: Printing Stack Trace
          at printStackTrace (src/mongo/shell/utils.js:38:15)
          at doassert (src/mongo/shell/assert.js:6:5)
          at Function.assert.commandWorked (src/mongo/shell/assert.js:238:5)
          at DBCollection.aggregate (src/mongo/shell/collection.js:907:12)
          at (shell):1:9
      2013-11-03T19:23:27.549-0500 command failed: {
      	"errmsg" : "exception: Tried to create string longer than 16MB",
      	"code" : 16493,
      	"ok" : 0
      } : aggregate with cursor failed at src/mongo/shell/assert.js:7
       
      // Verify we can read the document without printing it out...
      > Object.bsonsize( db.test.findOne({}) )
      16777216

      Show
      The session below shows how to create a document that is close to the maximum size and then retrieve it with an aggregation command (using a cursor) and with a findOne(). The aggregation fails. MongoDB shell version: 2.5.3 connecting to: test Server has startup warnings: 2013-11-03T19:16:05.526-0500 [initandlisten] 2013-11-03T19:16:05.526-0500 [initandlisten] ** NOTE: This is a development version (2.5.3) of MongoDB. 2013-11-03T19:16:05.526-0500 [initandlisten] ** Not recommended for production. 2013-11-03T19:16:05.526-0500 [initandlisten] // As big a document as we can make. > var bytes=(16 * 1024 * 1024) - (4 + 6 + 5); // ... using one large hex string. > var hex="" > for ( var i = 0; i < bytes; ++i ) { hex=hex+"00"; } ; db.test.insert( { "_id" : HexData( 0, hex ) } ) > db.test.find({}, { _id : 0 } ) { } > db.test.aggregate( { $match : {} } ) assert: command failed: { "errmsg" : "exception: Tried to create string longer than 16MB", "code" : 16493, "ok" : 0 } : aggregate with cursor failed Error: Printing Stack Trace at printStackTrace (src/mongo/shell/utils.js:38:15) at doassert (src/mongo/shell/assert.js:6:5) at Function.assert.commandWorked (src/mongo/shell/assert.js:238:5) at DBCollection.aggregate (src/mongo/shell/collection.js:907:12) at (shell):1:9 2013-11-03T19:23:27.549-0500 command failed: { "errmsg" : "exception: Tried to create string longer than 16MB", "code" : 16493, "ok" : 0 } : aggregate with cursor failed at src/mongo/shell/assert.js:7   // Verify we can read the document without printing it out... > Object.bsonsize( db.test.findOne({}) ) 16777216

      Description

      If the aggregation framework returns a cursor where the first document is close to the maximum size that it will fail with an error similar to:

      assert: command failed: {
      	"errmsg" : "exception: Tried to create string longer than 16MB",
      	"code" : 16493,
      	"ok" : 0
      } : aggregate with cursor failed

      See also this discussion on the Google Groups Developer List: https://groups.google.com/d/topic/mongodb-dev/Hi2DiX1F_FA/discussion

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: