Hi
On the Output from system.profile:
it mentions that it is a findOne() query/command - this removes the need for a limit if it is specified on the application side
this could be due to where the projection stage is set as mongodb interprets it from the application, it places the step as last for the data you want after it is sorted, whereas in your manual query it is forced to project the data and then sort - mongodb might be more strict to follow your stages from the application but be more lenient from the manual because the 1 document scanned could have already been returned from the “userId” and “profileId” find and then sort that single document(because the index exists)
Based on the version of your Deployment, please take the SBE into account: https://www.mongodb.com/docs/v7.1/reference/sbe/#:~:text=Starting%20in%20MongoDB%206.2%2C%20slow,execution%20engine%20executed%20the%20query.
hope this helps but the different findOne() and find().limit(1) might be why -
lastly I’m not sure you specified which one is the slow query?