Java with mongodb -


i getting following exception when tried fetch data mongodb collection. collection having huge data.

the exception is:

com.mongodb.mongoqueryexception: query failed error code 10334 , error message 'bsonobj size: 24020168 (0x16e84c8) invalid. size must between 0 , 16793600(16mb)' on server 10.15.0.227:27017 

and following query used data mongodb:

db.getcollection('triggered_policies').aggregate( [{ "$match" : { "policy_name" : "eiqsoc-1040-ec"}},  { "$project" : { "cust_created_at" : { "$add" : [ "$created_at" , 19800000]} , "event_ids" : "$event_ids" , "trigger_time" : "$trigger_time" , "created_at" : "$created_at" , "triggered_rules" : "$triggered_rules"}}, { "$sort" : { "created_at" : -1}}, { "$group" :      { "_id" :          {              "$hour" : "$cust_created_at"} ,              "triggered_policies" : { "$addtoset" : { "trigger_time" : "$trigger_time" , "created_at" : "$created_at" , "event_ids" : "$event_ids" , "triggered_rules" : "$triggered_rules"}         }     } },  { "$sort" : { "_id" : 1}} ]) 

following exact exception getting:

error: getmore command failed: {     "ok" : 0,     "errmsg" : "bsonobj size: 25994482 (0x18ca4f2) invalid. size must between 0 , 16793600(16mb)",     "code" : 10334 } 

please solve issue.

looks document created during aggregation exceeds 16mb size restriction in mongo db. might have change aggregate query not accumulate data single document exceeds 16mb size limit.

below quote mongo db documentation:

bson document size maximum bson document size 16 megabytes. maximum document size helps ensure single document cannot use excessive amount of ram or, during transmission, excessive amount of bandwidth. store documents larger maximum size, mongodb provides gridfs api. see mongofiles , documentation driver more information gridfs.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -