# MongoDB vs Scylla ## MongoDB ### Pros - Simple data model - Single table (?) for data (messages) that supports protocol changes - Simple writes if so - No need to maintain mongo lib ### Cons - Bson type limitations - No support for `u64`, meaning message `nonce` cannot be represented properly - Complicated read access - Dependent on protocol version as index locations will change - May need additional index tables to support indexing arrays within messages - For instance, outputs (not messages) are indexed by address - Need to ensure that your indexes are correctly implemented or in the correct order. Otherwise, MongoDB’s speed drops significantly - Potentially higher space complexity - Single point of failure due to master-slave architecture; ## ScyllaDB ### Pros - Good for high-write workload - It follows peer-to-peer architecture rather than master-slave architecture, so there isn’t a single point of failure; ### Cons - Advanced data model - Data-modeling design cost; - Needs to know the access pattern in advance; - Cannot update the primary key schema; - Wide column store - Wide-column store limited to adding/removing non-primary key columns - No support for dynamic partitioning (yet) - Users have to ensure their data-model is well designed and safe to deply in production - Cassandra query language - SQL-like DML and DDL statements; - User defined (function, aggregation, types); - Data is modeled around queries and not structure, resulting in the same information stored multiple times - Scylla was optimized from the start for fast writes, reading got the short end of the stick, so it tends to be slower ## Differences - Scylla uses a traditional model with a table structure, using rows and columns. MongoDB employs an objective-oriented or data-oriented model; - Scylla offers an assortment of master nodes, while MongoDB uses a single master node. As a result, Scylla provides higher availability, compared to MongoDB’s limited availability; - While both offer better than average scalability, Scylla provides higher scalability thanks to the multiple master nodes; - Scylla has a dedicated in-house query language, CQL, whereas MongoDB’s queries are structured into JSON fragments; - Scylla has no internal aggregation framework, relying instead on tools such as Apache Spark and Hadoop. MongoDB has its own aggregation framework, though it’s best suited for small to medium-sized data traffic loads; - MongoDB supports ad-hoc queries, aggregation, collections, file storage, indexing, load balancing, replication, and transactions; Cassandra offers core components like clusters, commit logs, data centers, memory tables, and Node;