The document describes the design of a mobile scavenger hunt app. It includes 3 parts: 1) architecture and design, 2) geo-spatial indexing and queries, and 3) deployment readiness. The app allows users to create scavenger hunts by pinning waypoints. Players can search for hunts near their location and track their progress. The design involves collections for waypoints, users, messages, and notifications to support location-based games and social features.
12. 12
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
13. 13
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
14. 14
Waypoint
{ _id: ObjectId(),
user: UUID,
tour: UUDI
name: "Doug's Dogs",
desc: "The best hot-dog",
clues: [
"Hungry for a Coney Island?",
"Ask for Dr. Frankenfurter",
"Look for the hot dog stand"
],
"geometry": {
"type": "Point",
"coordinates": [125.6, 10.1] }
};
Geospacial Index:
ensureIndex(
{ geometry: “2dsphere” }
)
27. 27
Notifications / Messaging
Message
{
sender: “Hypatia”,
recipients: [
“Democritus”,
“Euripides”,
“Eratosthenes”
]
date: ISODate(),
message: “truth is a point of view, and
so is changeable”
}
28. 28
Notifications / Messaging
Message
{
sender: “Hypatia”,
recipients: [
“Democritus”,
“Euripides”,
“Eratosthenes”
]
date: ISODate(),
message: “truth is a point of view, and
so is changeable”
}
db.messages.find(
{ recipients: “Democritus”}
);
33. 33
One Document per Message per Recipient
{
sender: “Hypatia”,
recipient: “Democritus”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}
{
sender: “Hypatia”,
recipient: “Euripides”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}
{
sender: “Hypatia”,
recipient: “Eratosthenes”,
date: ISODate(),
message: “truth is a point of view, and so is changeable”
}