Find query with large amount of data

-i have lots of data 6lkh up record and I fire find query with modelname.find({isDelete:false)} and indexing name field with will return also select name field. if user search the name then filter option like if

( !== undefined && !== null) {
        filter.$text = { $search: };

my code like

const filter: any = { isDeleted: false, venueOwnerId: null };

      if ( !== undefined && !== null) {
        filter.$text = { $search: };

      const restaurant = await this.restaurantModel.find(filter, {
        _id: 1,
        name: 1,

but we fire all record my total record around 6lakhs up then it load API not any response from db How can I get a large amount of data in less time in MongoDB? Is the above program correct? If so, please update it.

Hey @khushbu_N_A,

Welcome to the MongoDB Community!

To better understand the question, could you please share a sample document and the query you have tried so far? Also, share the expected output, so the community can better assist you.

Also, share the output of db.<collection_name>.getIndexes().

Could you further clarify the above statement and share some examples to better understand it?

It depends upon several factors, depending upon your query, you might need to create an appropriate index and use an aggregation pipeline to get the resultant data.

Looking forward to your response.

Best regards,