What's happening in Mongo when you are calling find and iterating over cursor?

I mean, how is cursor actually implemented? I understand that when you call find, you'll get reference to cursor (or rather ID), which has by default 10 minute time out. While alive you can iterate over it and you'll get data in batches. That's about the extent of info I found in docs about how it works.

What I'm asking is, when I query mongo, what does it actually do once it finds results? Does it generate a list of document ids for cursor to read from and load actual documents? Does it cache actual resulting documents? How does it handle changes in documents when there is live cursor? What are the performance and memory implications?

Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.