Where is index being stored

Hi - I am little confused on where the index keys are really stored? Is it stored in disk for each collections or will that be in RAM? I see that /data/db can have separate index folder which i assume as disk, but i get confused when i see ‘ensure index fits in RAM’. Please clarify this. Thanks.

@pvaithee07

The index is loaded from disk and stored in RAM, like many files. So the index data resides permanently on disk, but as the database is working, it’s loaded into RAM in so far as possible.