Base64 images (small size) causing long delay in search results

I’m new to MongoDB Atlas, so it’s very possible I’m missing something. My database which only has a few items while testing, has a couple base64 jpgs. For my app, I search the database for the right record, then grab the corresponding image. When I first started, the results were coming back within a few seconds. However in the past few days, they take between 5-7 seconds which causes the POST request to time out.

To test that it’s for sure the base64 images causing it, I replaced them all with regular .jpg URLs, and the responses came back instantly. Then I added one base64 to the table, and the delay occured again. So it must be taking a very long time just to determine if the record with the base64 fits the criteria or not, which seems strange because that’s not even the field I’m using to qualify the right database record.

I hope this makes sense. Happy to share any more details if you need. Thanks for your help.

I am also having some issues, on first 5 to 8 image upload it was calling in seconds but later now it’s taking more than 1 minute! Please help,

@Manuel_N_A,

To help us troubleshoot this further we’ll need a bit more information. For example:

  • What cluster tier are you using (M0, M2, M10, M30, etc)?
  • Are you using a MongoDB Driver directly or a library such as Mongoose?
  • How are you searching? Can you share the code for your POST route?
  • Do you have any application logs that show the request timing out?
  • Can you share your Image model/schema (assuming you have this defined in code)?

It’s entirely possible that the search method you’ve employed is missing an index that could be used to optimize this operation, but we’ll need to better understand the current state before making any recommendations :slight_smile: