I'm on the way to build a Chrome app, dedicated to fulfill shop/marketplace orders. The orders come from marketplace APIs like Amazon MWS. The data is stored only in the app (with backup). The system need also to work in a quick way if 50.000 or 100.000 orders are stored.
So how to structure the IndexedDB for that?
Each order can have multiple ordered items. It can also have multiple parcel tracking codes and so on.
var simplifiedOrderObject = {
"ordernumber": "123-12345-234",
"name": "Mr. Sample",
"address": "Foostreet 12, 12345 Bar York",
"orderitems": [
{
"item": "brush",
"price": "2.00"
},
{
"item": "phone",
"price": "30.90"
}
],
"parcels": [
{
"service": "DHL",
"track": "12345"
},
{
"service": "UPS",
"track": "3254231514"
}
]
}
Should i create only one objectStore, which holds the complete order data in one object/row like shown above? If i would do so: Is it possible and fast to have an index for search for a parcel number? - Again: multiple parcel numbers can be in each object/row.
Or is it better or even needed to do it like in relational DBs:
- One ObjectStore for order
- one for orderItem
- one for parcels shipped ... and all of this is connected by having the same orderNumber?
Which is the faster and more efficient way?