-
Type: Improvement
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: 2021.0
-
Component/s: Core MongoDB
-
Tags:
MongoDBConnection#queryAndFetch iterates over all the documents which match the query to build the DBSQueryResult object.
If the queryAndFetch method returns many documents, some developers have observed that it can lead to an OutOfMemoryError. Because of that, Nuxeo's recommendation is to use BAF instead of queryAndFetch when the database is MongoDB (no issue with VCS which uses an iterator).
The same way that Nuxeo logs a message when a too big selection is done (Selection#warnIfBig with the default threshold = 15000), it would help the developers to have a warning when they use MongoDBConnection#queryAndFetch. The threshold has to be defined.