Is there a way to add allowDiscUse: true
when using jongo to query MongoDB?
I found out that such error - `Sort exceeded memory limit of 104857600 bytes, but did not opt in to external sorting. Aborting operation. Pass allowDiskUse:true to opt in can be prevented in such a way, that your aggregate looks like
aggregate([{$sort:...},{$$skip:...}...],{allowDiscUse: true})
but as far as I see Aggregate
class in Jongo only applies pipeline to itself, which you can then execute with as
method.
MongoCollection catalogCollection = mongoHolder.getCatalogJongo(param.id, false);
Aggregate aggregation = catalogCollection.aggregate("{$match: #}", query.build());
aggregation.and("{$skip: #}", param.offset);
aggregation.and("{$limit: #}", param.limit);
List<BasicDBObject> result = aggregation.as(BasicDBObject.class);
Is there any way of passing that parameter to mongo without switching from Jongo to something else?