Query taking 10x longer

Since February 7th, I’ve noticed that when running a large query, the execution time has increased dramatically, becoming about 10 times longer.

The query is being called through C#, and there are only about 2500 records in total. Before February 7th, the query took around 3 seconds to complete, but now it takes over 30 seconds.

Interestingly, when I run the same query through MongoDB Compass, it executes quickly as expected. However, any query execution outside of MongoDB Compass (e.g., through my C# code) is taking around 30 seconds.

I can’t figure out what is causing this delay, as no code changes have been made recently.

I’m curious… If you’re running Compass from your local computer, and the application is running from a server somewhere, I’m tempted to accuse the network. Can you verify the connectivity between your local, and your application nodes?

Try measuring connection time… something like:

var client = new MongoClient("your_connection_string");
stopwatch.Stop();
Console.WriteLine($"Connection Time: {stopwatch.ElapsedMilliseconds} ms");
`

When I run the query in compass it runs fast. When I use the same query is visual studio it now takes 30 seconds. Also when I run it from AWS lambda function it takes 30 seconds. This all started on the 7th