passing allowDiscUse parameter for .as Aggregate method

55 views
Skip to first unread message

Nikita Buriak

unread,
Apr 15, 2016, 5:39:09 AM4/15/16
to Jongo

Is there a way to add allowDiscUse: true when using jongo to queri 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?

Benoît Guérout

unread,
Apr 17, 2016, 4:20:24 PM4/17/16
to jongo...@googlegroups.com
Hello,

This question has been answered on stackoverflow http://stackoverflow.com/a/36681741/122975

--
You received this message because you are subscribed to the Google Groups "Jongo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jongo-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages