Stock Management Software with MongoDB

We are trying to build a small stock management web app for a small company. It is the first time that we use NoSQL DB. We designed a system with these collections;

  • Users
  • Countries (Contains Regions document as Array)
  • Regions (Contains Unit document as Array)
  • Units (Contains Sales and Stocks Entries as Array)
  • Sales
  • Stocks
    However, because of the high data density in Sales/Stocks, we are trying to find a simple and optimum scheme design. We are keeping all data in one document for now but while the data is entered, probably we could face a chaotic result. We need a better solution. Thanks everybody.

Hi Yunus,

I will recommend going through one of our schema design trainings and also reviewing the following documents:

Now regarding the presented use case I find it hard to understand , is every mentioned entity is a collection? Does the units one represent a many to many relationship?

Additionally, what do you mean by a single stock document… What does this document hold? Is it a document per stock with its history and sales is sach transaction documents?