Database Design
As per the requirements described in the previous sections, the three basic entities to be persisted are user
, vehicle
, and ride
. The user
and vehicle
entities will store the attributes of users and vehicles respectively, while the ride
entity will be created whenever a new ride is commenced.
Apart from the basic entities, an additional entity is needed to track the bike ride logs. For each active ride, the system captures and logs the bike's location. The logs will be used for reporting and analytics purposes.
Because of the document-based dataset offered by MongoDB, all the entities can easily be designed as collections. These collections and some of their sample records will be explored in the next sections.
Users
The users
collection holds data for all who have registered in the system. The following code snippet shows a sample document that represents one of the registered users:
{ "_id" : "a6e36e30-41fa...