Today I read about databases and applications. I read the book MongoDB The Definitive Guide 2nd Edition from Oreally. Here some notes to think about how to schedule the databases:
- The databases should be build thinking about the queries, about the usability of the application. It is important to organise to database thinking in the rate of queries, the updates, etc.
- Optimizing reads generally involves having the correct indexes and returning as much of the information as possible in a single document. Optimizing writes usually involves minimizing the number of indexes you have and making updates as efficient as possible.
- In general, documents with a similar schema should be kept in the same collection. MongoDB generally disallows combining data from multiple collections, so if there are documents that need to be queried or aggregated together, those are good candidates for putting in one big collection.
- Each database resides in its own files and often its own directory on disk, which means that you could mount different databases to different volumes. Thus, you may want all items within a database to be of similar “quality,” similar access pattern, or similar traffic levels. It is a good practice to divide users in a different database, so it can be protected in a different way. A user database is greatly important, it is prior to protect this information.
Last day the tasks I did was:
- Add GET of list notes in the API. It is not completer but it helps me to continue the work in the frontend
- Adding preliminary funtions to get the info from the api. I learn how to use services in angular, this way I can scrap the information from the API.
For today, or the tasks I can do it today are:
- Open a note when click
- Update a note
For the future days it would be nice to implement Mongodb change streams using pusher. Here another example of Mongodb streams. Another example using socket io, otro ejemplo con sockets.