Reputation: 136
I have this document
item = {
"name": "string",
"promotions": [{
"store_id": "key",
"url": "string",
"prices": [{
"cc": "string",
"price_regular_in_cent": "integer",
"price_sale_in_cent": "integer",
"percent": "integer"
}]
}]
}
for a demo promotion app that I'm developing to learn NodeJS, MongoDB and Angular. The top level is where the item information go, the promotions is there each promotion go for the same item (each item can be in multiple stores) and the prices is the price in each supported currency. I created this structure since I don't want to know the price without knowing the item but I have some problems with filtering.
Edit: For example if i wanted to filter all items in the db with percent >50 how would I do it in mongodb? And is the performance optimal?
And I'm thinking this data structure should be better implemented with SQL instead of NoSQL, is this correct?
Upvotes: 0
Views: 117
Reputation: 14369
If it is just one demo that you need to do, I would say that even if you want to keep the data in a RDBMS you better de-normalize it for extracting the best performance.
Now since you are anyways de-normalizing it, why not use a NoSQL DB?
So if you are open to either use a RDBMS (and keep the data de-normalized) or use a NoSQL DB, you will have to implement your demo on both and then compare the performance to make your choice.
I did not understand what you are saying here -
For that I have read its impossible, or at least inefficient when comparing to SQL, to filter the all items for one currency by percent, is this true? Or all item by the same store_id?
Lastly, regarding the design you did in your question, the design seems fine in first glance.
Upvotes: 1