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:
Best
Pavel
Hello,
I have exactly the same issue, but I’m afraid I still haven’t managed to resolve it. When I try to use find with {},{},{allowDiskUse : true } on my view in Compass, I get the same error.
Any chance you could help me out with this please?
Thanks a lot,
Emily
Welcome to the MongoDB Community Forums @jamiesone!
Please provide some more details on the issue you are encountering:
- version of Compass
- steps to reproduce
- error message received
- type of deployment you are connecting to (if that happens to be MongoDB Atlas, please mention the cluster tier, eg M0).
Thanks,
Stennie
Thank you for your reply!
I have exactly the same issue as the other post in this thread. I’m using the Compass aggregation builder to run a long pipeline including $group which previously worked, but now gives me the error
ah sorry I can’t work out how to edit my previous post…
It now gives me the error “PlanExecutor error during aggregation :: caused by :: Exceeded memory limit for $group, but didn’t allow external sort. Pass allowDiskUse:true to opt in.”
I tried filtering the view as you suggested,
But it gives me the same error.
I’m using Compass version 1.20.5 and the deployment is a MongoDB 5.0.2 Community on a kubernetes cluster
Thanks again,
Emily
Hi @jamiesone ,
I honestly don’t recall how to pass that in compass.
Can you build aggregation and run it with this setting in the shell tab?
Thanks
Pavel
Thanks for your reply! Yes, it definitely works in the shell once I’ve added the allowDiskUse setting. But we’d really like to find out how to enable this setting in Compass if possible as my colleague then runs a whole lot of other filters on the view, so it’s really practical to be able to do this in Compass.
Thanks again,
Emily
Hi @jamiesone ,
Are you working with atlas? If yes what instances?
Compass should add this by default…
Hello,
No, I’m not working with Atlas, I’m using MongoDB 5.0.2 Community on a kubernetes cluster.
It seems like the functionality was added at some point?
https://jira.mongodb.org/browse/COMPASS-2722
Thanks again for your help,
Emily
Hi Emily. I am having the exact same problem. I follow the instructions line by line but at the end of it I only get an empty view. How did you solve it?
Hi Marek!
Have you found a way to solve this?
I’m also facing this issue with Compass Version 1.34.2 (1.34.2).
How does one pass in this option to the fields?
Hi Dylan. Did you find a solution to this problem? Thanks.