Hello,
I am using sample_airbnb database with listingsAndReviews collection. I would like to use the string field
room_type:“Entire home/apt” to sort my query. Could you please let me know my error in the following script:
MongoServerError: Executor error during find command :: caused by :: Sort exceeded memory limit of 33554432 bytes, but did not opt in to external sorting.
Hi @john_Doe3,
Each document in the sample_airbnb’s listingAndReviews collection has around 45 fields.
Since with more than 5.6k documents and an average size of 17KB/document it would take a lot of memory and time to sort the results.
Do you need all the 45 fields that are there? If not, a projection on the fields you need might be helpful in your case.
If you have any doubts, please feel free to reach out to us.
The first object {} passed to find() is used to filter the results based on the expression, here we have used an empty object, therefore all the documents in the collection will be returned.
And the second object { interaction: 1, name: 1, _id: 0 } is used to project the fields that we want in the results, therefore only interaction, name, and _id will be returned in resulted documents.
If you have any doubts, please feel free to reach out to us.
Hi Sourahb, many thanks. I still get the same error. However, when I added limit of 500, it works properly. Adding a limit of 5000 wont work. Thanks again for your help!
have a good one,
My apology, I have already tried the test without sucess.
db.test.aggregate([ {$match: {node:1}} , { $graphLookup: {from : “test”, startWith: “$node”, connectFromField: “connectedTo”, connectToField:“node”, as: “demo”} } ]).pretty()