DEV Community

Amr Hassan
Amr Hassan

Posted on • Originally published at blog.amr-hassan.xyz on

MongoDB vs DynamoDB for your (side) project

So here I'm wanting to create an MVP for a side project of mine and look for the cheapest DB aka cheapest data provider to use and let my baby see the daylight with the possibility of scaling and paying less money of course, but before boring you with the comparison I need to tell you more about my use case.

Data access layer (Functional)

I need to list my data accessing pattern first which were:

  • Insert schemaless data (obviously)

  • Update the last seen of a record

  • Query the last 5 elements

In the future queries:

  • How many updated records per week, month, year

Going to ignore the non-functional, come on it's a side project don't judge me

Data ETA

Assuming that most of the data types going to be text/string with a maximum size of 100KB per record.

How many records going to store per week or month?

10 in the day, 70 in the week, 300 records per month per user

Assuming that we want to support 100 users as a start

100 users * 300 records => 30K per month with the size of 30k * 100KB => 3GB per month

DynamoDB vs MongoDB

DynamoDB MongoDB
storage free tier Free 25 GB of storage AWS Free Tier 512MB to 5GB of storage Shared RAM Upgrade to dedicated clusters for full functionality No credit card required to start
vendor lock-in amazon specific svc could use it on your side or Atlas's side
monitoring provisioning, monitoring, and keeping servers running (not to mention making backups). none unless you are using Atlas and would have limited feat compared to a dynamo
security better meh
record size 400kb 16 MB.
query basic key-value lookup without the elastic map reduce better querying framework
data types number, string, and binary int, long, date, timestamp, geospatial, floating-point, and decimal128
consistency eventual data consistency No data validation - must be handled in application ACID transactions apply to table data only, not to indexes or backups Maximum of 25 writes per transaction strong data consistency Native schema governance and data validation ACID transactions apply to documents, indexes, and backups 1,000 operations per transaction (executing within 60 seconds by default)
connections HTTPS - kinda unlimited TCP - M0/M2 cluster tier is 500 per node
indexing Limited / Complex to manage Indexes are sized, billed & provisioned separately from data Robust / Easy to develop against No extra cost to index your data

For my use case dynamo fail on the querying side which is important for me compared to the storage and scale for now at least.

Someday will have a use case to abuse dynamodb with but for now, my rational mind says no, for now, how about you would you do the same?

Top comments (0)