Info
When creating a sequence of views on views, the final resolved pipeline may exceed the maximum document size. This will be bad if the view is on a sharded collection, as the error response from the primary shard to mongos will be too large to handle.
We should impose some sort of limit when creating/modifying a view definition and/or check the size of the resolved view on resolution and fail if it is too large.
Top User Comments
xgen-internal-githook commented on Thu, 22 Sep 2016 19:19:41 +0000:
Author:
{u'name': u'Sam Rossi', u'email': u'sam.rossi@mongodb.com'}
Message: SERVER-25444 Enforce max size of view pipeline
Branch: master
https://github.com/mongodb/mongo/commit/f986217cc7ad341aa19e2eba23be458e1ff1e0e4
schwerin commented on Mon, 8 Aug 2016 14:51:24 +0000:
I think it will be hard to do this at view modification time, since you might be modifying the middle view that's part of many other views, and you'd have to find all of them and validate them. Even then, users might still manage to write to system.views directly and create illegally sized view pipelines.
As such, I recommend that this check be complemented with work to ensure that the user gets a helpful error message when they attempt to query a view that is too large, regardless of whether the cluster is sharded or not.