Use Cases
The preceding sections provided an overview of the City Bikes system, the requirements and considerations, and the database structure. Now, we will list the system use cases using some example scenarios and the database queries to run through them. This will help verify the correctness of the design and help ensure that no requirement is missed.
User Finds Available Bikes
Consider a situation in which a user opens the app on their mobile phone and clicks to find a bike in a radius of 300 meters from their location. The user's current coordinates are Longitude 111.189528 and Latitude -72.454567. The next snippet shows the corresponding database query:
db.vehicles.find({ "vehicle_type" : "bike", "status" : "available", "location" : { $near : { ...