Choosing the database API in Cosmos DB

As you already know, at the time of writing, Cosmos DB provides four database APIs and we can choose or combine them together, as per our need. Right now, we have a requirement for the database which can write the data in an efficient way because, in email tracking, we are going to update our records frequently.

Our requirement for the read operation is not that huge: the tracking data can be easily served to the user or transferred to a data analytics engine.

So, here is the thing: if we had to manually install or choose the database, then these metrics would come into the picture. Cosmos DB is a managed database service with SLA of their consistency and latency, hence, any database API which your application can easily integrate with should work here as well.

I would prefer to go with MongoDB API support because of the following two reasons:

  • It is JSON-based, and can easily synchronize with the analytics engine
  • It offers native support in Node.js, and is easy to program and integrate

So yes, we are going to use MongoDB API in Cosmos DB to track and record our emails.

Let's dive into the code and write our simple email sender.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.172.50