hey when we make any index on any field if space is available it stored in ram for fast query but when we query with index field what happen to our document it load whole collection or only document that satisfies query in ram because of index???
In general, I don’t like to criticize students English, as I don’t speak any other language with any fluency myself. However, in this case, your question does not really make sense and would need to be re-worked. In any case, the course is over and I’m terminating my TA work tonight. As this is really a general question, I would suggest that you rephrase this a bit and then post it on one of the general MongoDB forums. Good luck.
You are right, indexes are stored in memory.
mongod did not have to scan all of the documents, and only the matching documents had to be pulled into memory.
Here is the documentation link: Analyze Query Performance that can help better understanding the concepts for index.