Will data api be faster in the future?

as above documentation introduced, Data api takes longer to complete than driver.

  1. i wonder if Data api will faster than driver in the future.
  2. and if i wanna use vercel’s edge function to connect with mongodb, how could i do?

Hi @11115_1 and welcome to the MongoDB community forum!!

The Driver and the Data API are two different aspects when it comes to querying the data in MongoDB.
The MongoDB drivers generally resides on the servers, and act as the bridge in between the request and the database server. However, the Data API acts as an additional layer to the request being made.
Despite the fact that the data API includes an extra compute and network layer, it provides straightforward API logic out of the box, as well as serverless functions and separate rules/schema validation. It also acts as a proxy, assisting in the management of networks at scale.

Also, as mentioned in the documentation, for applications which require low latency, using drivers is the recommended method.
Depending on your use case, you can choose in between using the drivers and the Atlas Data API.

If I understand the question correctly, you are looking to connect the Vercel’s edge function to the serverless Atlas. In that case, the blog post on Integrate MongoDB into Vercel Functions for the Serverless Experience might be a useful information to answer the question.

Please let us know if my understanding is wrong here.

Let us know if you have any further questions.

Best Regards

1 Like

i appreciate your reply! and i mentioned vercels’s function is edge function which is different from serverless function. and it runs on edge runtime not nodejs. i wanna check mongodb in nextjs’s middleware that runs on edge runtime. how could we connect mongo using edge function?

this links will helpfull! :slight_smile:
edge runtime
edge middleware
this is why i need mongodb support