MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

allowDiskUse setting in Compass

Hello.
I’m trying to build a view using Compass aggregation builder. I want to use $ group. Due to the size of the source collection, I need to add {allowDiskUse: true} to the aggregation pipeline. How and where can I set this parameter using Compass?
Thank you in advance for your help,
Regards,
Marek

Hi @Marek_Bisztyga,

Welcome to MongoDB community!

Compass allows you to use a sample mode in the aggregation builder therefore you should be able to construct your pipeline in compass and use the “export” button in the end.

Only in 4.4 you can add the allowDiskUse is allowed in find.

The {allowDiskUse: true} should be added to the query/aggregate command used on the already defined view therefore it cannot be done as part of the agg builder.

Hope that helps.

Best
Pavel

Hi @Pavel_Duchovny
To add {allowDiskUse: true} to an already defined (through the aggregate command) view, I have to define the view first, and I cannot do this because to define it I have to add {allowDiskUse: true}.
Is my reasoning correct?
Best
Marek

Hi @Marek_Bisztyga,

Not necessarily. You can attempt the following:

Create view with pipeline without the allowDiskUse, example:

 db.createView("myView", "myColl" ,  [ { $group : {"_id" : "$id" , arr : { $push : "$value" }} }])

The view only consume the data when you query it. Here you can use the allowDiskUse:
Prior 4.4 -

db.myView.aggregate([],{allowDiskUse : true });

From 4.4 you can use find:

 db.myView.find({},{},{allowDiskUse : true })

Thanks
Pavel

Hi Pavel.
It works.
Now I have to figure out how to make the Tableau, which is supposed to see this view, work the same way.
Thanks for the help.
Best,
Marek

Hi @Marek_Bisztyga,

How do you connect to tableau? If its through the BI connector it always set allowDiskUse option on . So it should work:
https://docs.mongodb.com/bi-connector/master/faq

Best
Pavel

Hi @Pavel_Duchovny
Oh! Great news!
Thank you.