I'm analyzing the includes in a build using the '/showIncludes', on Windows, and '-H', on *nix, flags.
I'm parsing this info with a python script. Each file included is turned into an object that lists its children (files it includes) and ancestors (the include paths which included this file).
After these objects are created I want to push them into a mongodb database using pymongo.
This works fine for 99% of the includes. But ~5 are very large. When I try to add them to mongodb it complains.
Traceback (most recent call last):
File "mongodb.py", line 94, in <module>
includes_collection.update({'id': include.include_id}, { 'ancestor_tree': ancestor_tree_ids } )
File "C:\Python27\lib\site-packages\pymongo-2.7.2-py2.7-win-amd64.egg\pymongo\collection.py", line 551, in update
docs, check_keys, self.uuid_subtype, client)
DocumentTooLarge: command document too large
Reading up on mongo this seems to be a design choice. By default documents cannot exceed 16Mb. But that can be overridden with the --nssize command line option. See
http://docs.mongodb.org/manual/reference/program/mongod/#bin.mongod
So I re-ran mongod with --nssize 32/64/128. I don't think any of my include objects are above 128Mbs. But the issue persisted.
So I'm now wondering if pymongo is to blame. Does it respect this server setting?
My version of mongod is
db version v2.6.3 2014-08-28T16:56:51.534+0100 git version: 255f67a66f9603c59380b2a389e386910bbb52cb
I'm using pymongo-2.7.2-py2.7-win-amd64.
Is there anyway to work around this limitation?
16 MBis quite a lot of data for a single document... - Leonid Beschastny