I have been testing out mongodb atlas new Data-API.
I have found quite a big hurdle in the way the length of time it takes for a simple document to be returned using /findOne
In comparison , I am using a aws lambda function using the normal node driver to create a database connection to my atlas cluster. Every time the function runs cold the total connection time is about 3 seconds. (warmup, create connection to atlas, query and return the data)
However when the function is warm and the database connection is re-used the round trip time to get data is ranges from 200-800ms (huge difference)
I expected that the data-api would perform much better, but on average it is about 3-4 seconds, and never better on subsequent tries.
Does it mean the using the data api to http://data.mongodb-api.com/xxxx which i believe behind the scenes invokes another cloud function and therefore is always cold and the db connection is always closed?
Using a simple data-set the data-api seems very slow when using the drivers.
Any support on what I may be doing wrong would be appreciated.