Question: You have a collection with millions of documents. Each time you attempt to sort. MongoDB runs out of memory. What might help?
- Use the purge operator before the sort.
- Return the entire collection and sort on the client.
- Pass the --more-memory option.
- Create an index on the field you are sorting.
Answer: The correct answer of the above question is Option D:Create an index on the field you are sorting.