Mongodb is too slow on selecting big data

Viewed 35

I am using Mongodb in a Nodejs application. The database has 17 million documents. I want to select 1 million in one query with mongoose.

const vehicles = await Vehicle.find({
  PassedTime: {
    $gte: startDate,
    $lte: endDate
  }
});

I've already created an index on PassedTime and set my mongodb profile on level 2 with {slowms: 20, sampleRate: 0.42}. But it takes many seconds. Same data in Mysql/PHP takes only 2 seconds (in another system with 256G SSD)! Is there something wrong? Can I do it faster with Mongodb/Nodejs?

Also I have 32GB memory, 4T HDD. Maybe it's all about HDD and SSD :")

0 Answers
Related