Database structure - brightstudent/backend GitHub Wiki

Data object

{
  "_id": {
    "$oid": "628693436e95e8004048b5f0"
  },
  "pictures": [
    "...",
    "...",
    "..."
  ],
  "name": "BBQ Meat",
  "location": "3.1 km",
  "slug": "bbq-meat",
  "favored": true
}

My data consists of an array for each restaurant. Each array consists of 6 objects.

  • The first one in the list is an object ID. This is automatically generated by mongodb when you insert a new object to the cluster.
  • The second object is an array of pictures. These pictures are defined as an URL.
  • The third object is a string that contains the name of the restaurant.
  • The fourth object is also a string that contains the distance of the restaurant. Ideally this would be a number that is generated by an external API that checks your location and calculates the distance to the restaurant. But this is purely for demonstrative purposes.
  • The fifth object is a slug which also is a string. This is used to display the details page that belongs to the restaurant. At least that was my intention. I ended up not needing this due to the lack of time. But I left it in there with the intention to keep developing the app in the future.
  • The last object is a boolean, which is used to specify if an object is saved by the user.