Hi there, it seems that the "allowDiskUse" was originally implemented for aggregate operation and Camel MongoDB component support it. Since Mongo DB 4.4 the same property is used for sort operation [1] and this is not yet implemented by Camel MongoDB component. You can log a request on Apache Camel Jira [2] to be considered for its development. In the while you may try to leverage aggregation, like with an empty aggregation an all the set and finally sorting.
Cheers, Pasquale. [1] https://docs.mongodb.com/manual/reference/method/cursor.allowDiskUse/ [2] https://issues.apache.org/jira/browse/CAMEL On Wed, Sep 30, 2020 at 8:30 PM Site Register <site.regis...@ymail.com.invalid> wrote: > Hi all, > I got below error message when I was trying to sort on huge mongodb > collection data even I turn on allowDiskUse to true. Any suggestions? > "Query failed with error code 292 and error message 'Executor error during > find command :: caused by :: Sort exceeded memory limit of 104857600 bytes, > but did not opt in to external sorting.' on server" > > from("vm:fetchMongoDB") .process("ServiceProcessor") > .setHeader(MongoDbConstants.ALLOW_DISK_USE, constant(true)) > .setHeader(MongoDbConstants.SORT_BY, > constant(Sorts.ascending("orderId"))) > .setHeader(MongoDbConstants.BATCH_SIZE, constant(100)) > .to("mongodb:mongoBean?database=mongoDb&collection=collectionName&operation=findAll") > > Thank you,