To end off, we'll add a couple of indices to our database to improve efficiency and prevent multiple requests from being open for a single table. After this, we'll add a favicon to personalize our web application.
Database indices are used to increase efficiency. Normally, to find a subset of documents in our database that match certain criteria (that is, whenever we use the MongoDB find()
method), the database engine has to examine each record and add the ones that match the returned result. If we add an index to a specific field, the database will store more metadata, which can be thought about as storing a sorted copy of this field. To find out whether [email protected]
appears in a sorted list is much more efficient than checking whether it appears in an unsorted list. However, the indices do take up additional storage space, so choosing where to add indices is a classic space-time tradeoff that's seen everywhere in computer science...