Database Reference
In-Depth Information
Sharding Concerns
For most deployments, sharding the categories collection has limited value because the col-
lection itself will have a small number of documents. If you do need to shard, since all the
queries use _id , it makes an appropriate shard key:
>>> db . command ( 'shardcollection' , 'dbname.categories' , {
... 'key' : { '_id' : 1 } })
{ "collectionsharded" : "dbname.categories" , "ok" : 1 }
Inventory Management
The most basic requirement of an ecommerce system is its checkout functionality. Beyond the
basic ability to fill up a shopping cart and pay, customers have come to expect online ordering
to account for out-of-stock conditions, not allowing them to place items in their shopping cart
unless those items are, in fact, available. This section provides an overview of an integrated
shopping cart and inventory management data model for an online store.
Solution Overview
Customers in ecommerce stores regularly add and remove items from their “shopping cart,”
change quantities multiple times, abandon the cart at any point, and sometimes have problems
during and after checkout that require a hold or canceled order. These activities make it dif-
ficult to maintain inventory systems and counts and to ensure that customers cannot “buy”
items that are unavailable while they shop in your store.
Thesolutionpresentedheremaintainsthetraditionalmetaphoroftheshoppingcart,butallows
inactive shopping carts to age . After a shopping cart has been inactive for a certain period of
time, all items in the cart re-enter the available inventory and the cart is emptied. The various
states that a shopping cart can be in, then, are summarized in Figure 5-5 .
Search WWH ::




Custom Search