AWS. Lesson 1. DynamoDB

DynamoDB is similar to MongoDB in some ways, but they also have key differences. Here's a comparison:

Similarities

  1. NoSQL Databases – Both are NoSQL databases, meaning they don’t use structured SQL tables like MySQL or PostgreSQL.

    • DynamoDB: Key-value & document store

    • MongoDB: Document store (JSON-like BSON format)

  2. Scalability – Both are highly scalable and designed for big data.

    • DynamoDB: Automatically scales read/write capacity.

    • MongoDB: Uses sharding and replication for scale.

  3. Flexible Schema – Unlike SQL databases, both allow schema-less data storage.

    • DynamoDB: Allows nested JSON objects within attributes.

    • MongoDB: Stores data as flexible BSON documents.

  4. Indexes – Both support indexing for faster queries.

    • DynamoDB: Primary key, sort key, secondary indexes.

    • MongoDB: Indexes on any field for fast retrieval.


Differences

FeatureDynamoDBMongoDB
Data ModelKey-Value & DocumentDocument-Oriented
StorageFully Managed (AWS)Self-hosted or Managed (Atlas)
Query LanguageNoSQL APIMongoDB Query Language (MQL)
PerformanceFast for key-value lookupsFast for complex queries
TransactionsLimited transactionsSupports ACID transactions
HostingAWS OnlyOn-premise or Cloud
Cost ModelPay-per-use (Read/Write units)Storage-based pricing

Which One to Use?

  • Choose DynamoDB → If you're using AWS and need serverless, auto-scaled, high-performance NoSQL.

  • Choose MongoDB → If you need complex queries, full-text search, or self-hosted control.