E-commerce apps with MongoDB
Kyle Banker (@hwaet) has two articles — ☞ here and ☞ here — explaining how combining some of the MongoDB feature can make it useful for e-commerce applications.
These articles are looking at scenarios like catalog management, shopping carts, orders and inventory management. Most of the proposed solutions for these solutions are based on a combination of MongoDB rich document support, row level atomic operations and inline operators and also the extensive querying support.
A lot of the arguments levied against NoSQL in e-commerce center around transactions, consistency, and durability. A couple points, then, are worth noting.
Concerning transactions, it is true that MongoDB doesn’t support the multi-object kind; however, it does support atomic operations on individual documents. And this, combined with the document-oriented modeling just described and a little creativity, is adequate to many e-commerce problems. Certainly, if we needed to literally debit one account and credit another in the same operation, or if we wanted rollback, we’d need full-fledged transactions. However, the transactionality provided by MongoDB may be sufficient for most, if not all, e-commerce operations.
If you’re concerned about consistency and durability, know that write operations in MongoDB can be made consistent across connections. Furthermore, MongoDB 1.5 support near-real-time replication, so that it’s now possible to assure that an operation has been replicated before returning.