Welcome to the MongoDB Community @Nicola_Ricci !

Since you are referring to text files, I assume you are asking about using Atlas Data Federation (which was known as Atlas Data Lake prior to June 2022). Data Federation allows you to query supported data formats (JSON, CSV, Parquet, Avro, …) in cloud object storage (eg AWS S3) using the MongoDB Query Language.

Data Federation works with supported file formats directly and does not import that data into MongoDB. If you want to efficiently read a subset of data, it will be better to filter the source files before saving to cloud storage. You could also choose to partition your data to support your common query patterns. However, as @Benjamin_Flast mentioned Data Federation would not be a good fit for your data format which appears to require a custom parser.

If your goal is to import your data into a MongoDB deployment, you probably want to be looking at using mongoimport or a custom import script. A custom script would be more appropriate if you are using unsupported file formats or want to filter data during ingestion.

Regards,
Stennie