0

I am creating an Android flash card app and I am thinking about using a document db, like MongoDB Stitch, to store my user's information. So far, I have thought about storing the following in a single document per user:

  • username
  • hashed password
  • some unique identifier for the user
  • an undetermined list of objects that will contain data for the front and back part of the flash card

I have do not have any experience working with no-SQL db's so I am not sure if this would be a good approach or not and would greatly appreciate some constructive feedback on whether this is poor design choice or not.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
mr nooby noob
  • 1,860
  • 5
  • 33
  • 56
  • It depends on whether you need to extract the data in different ways. For example, if you had a collection of Invoices, and every invoice has a collection of items, you could wrap all the items inside the invoice, but it would make variations in queries more difficult. What if you want to find out how many widgets you sold last September? Sure, you can get there, but imagine what it takes to code and how slow it will run. Busting one-to-many relations into separate collections will help you write easier queries which can be easily indexed and which will run much faster. – Jeff Matthews Jan 28 '18 at 22:59
  • On the flip-side, if your data is one-to-one, keep it together. – Jeff Matthews Jan 28 '18 at 23:00

0 Answers0