Transcript of 1140 p2 p04_and_1350_p2p05_and_1440_p2p06
- 1. Building a Mobile App! Part 1 { name: Bryan Reinero, title:
Developer Advocate, twitter: @blimpyacht, code: github.com/breinero
email: bryan@mongdb.com }
- 2. 2 Track Agenda Part 1: Architecture and Application Design
Part 2: Geo-Spatial Indexing and Queries Part 3:Deployment
Readiness
- 3. 3 Mobile Applications Location based data User relevance
Context Rich Social Engagement
- 4. 4 The Scavenger Hunt App Users create scavenger hunts by
pinning waypoints
- 5. 5 The Scavenger Hunt App Players search for a scavenger hunt
near their current position
- 6. 6 The Scavenger Hunt App Basic Requirements
- 7. 7 The Scavenger Hunt App Basic Requirements Mark target
points
- 8. 8 The Scavenger Hunt App Basic Requirements Mark target
points Identify our users
- 9. 9 The Scavenger Hunt App Basic Requirements Mark target
points Identify our users Mark users progress during hunts
- 10. Schema Design
- 11. 11 The Scavenger Hunt App Users create scavenger hunts by
pinning waypoints
- 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 }
)
- 15. 15 Waypoint Mobile Client
- 16. 16 Waypoint Application ServerMobile Client RESTful Service
scavenger.com/waypoints?lat=40.87&lon=-73.87&max=100 HTTP
GET
- 17. 17 Waypoint Application Server DatabaseMobile Client
RESTful Service
scavenger.com/waypoints?lat=40.87&lon=-73.87&max=100 HTTP
GET
- 18. 18 Waypoint Application Server DatabaseMobile Client
RESTful Service
scavenger.com/waypoints?lat=40.87&lon=-73.87&max=100 HTTP
GET Query { $geoNear: { $geometry: { type: "Point", coordinates: [
-174.9559, 40.6544 ] }, maxDistance: 100 }
- 19. 19 The Scavenger Hunt App Basic Requirements Mark target
points Identify our users Mark users progress during hunts
- 20. 20 The Scavenger Hunt App { _id: ObjectId(), user: UUID,
huntId: UUID, timestamp: ISODate(), geometry: { type: "Point",
coordinates: [ long, lat ] } }
- 21. 21 The Scavenger Hunt App Social Requirements Allow users
to follow one another Allow users to exchange messages Send users
notifications
- 22. 25 Social Interactions Eratosthenes Democritus Hypatia
Shemp Euripides
- 23. 26 User Collection { _id: UUID, name: Bryan Reinero, email:
bryan@mongodb.com, pass: dontyouwishyouknew, description: I am just
a guy, followers: [ Achille, Jason, Stephan, Norm ] }
- 24. 27 Social Interactions Followers Collection { follower:
Shemp, followed: Euripides}, { follower:Shemp, followed:
Eratosthenes}, { follower: Eratosthenes, followed: Shemp },
Eratosthenes Democritus Hypatia Shemp Euripides
- 25. 28 Social Interactions Eratosthenes Democritus Hypatia
Shemp Euripides Followers Collection { follower: Shemp, followed:
Euripides}, { follower:Shemp, followed: Eratosthenes}, { follower:
Eratosthenes, followed: Shemp }, ! (Euripides -> Shemp )
- 26. 29 Social Interactions db.followers.find( { follower:Shemp
} ); Followers Collection { follower: Shemp, followed: Euripides},
{ follower:Shemp, followed: Eratosthenes}, { follower:
Eratosthenes, followed: Shemp },
- 27. 30 Notifications / Messaging Message { sender: Hypatia,
recipients: [ Democritus, Euripides, Eratosthenes ] date:
ISODate(), message: truth is a point of view, and so is changeable
}
- 28. 31 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} );
- 29. 32 OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX
OUTBOX Notifications / Messaging db.messages.find( outbox.user:
Hypatia ); db.messages.find( outbox.user: Euripides);
db.messages.find( outbox.user: Democritus); db.messages.find(
outbox.user: Shemp);
- 30. 33 OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX
OUTBOX Notifications / Messaging db.messages.find( outbox.user:
Hypatia ); db.messages.find( outbox.user: Euripides);
db.messages.find( outbox.user: Democritus); db.messages.find(
outbox.user: Shemp);
- 31. 34 OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX
OUTBOX Notifications / Messaging db.messages.find( outbox.user:
Hypatia ); db.messages.find( outbox.user: Euripides);
db.messages.find( outbox.user: Democritus); db.messages.find(
outbox.user: Shemp);
- 32. 35 OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX OUTBOX
OUTBOX Notifications / Messaging db.messages.find( outbox.user:
Hypatia ); db.messages.find( outbox.user: Euripides);
db.messages.find( outbox.user: Democritus); db.messages.find(
outbox.user: Shemp);
- 33. 36 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 }
- 34. 37 Inbox Buckets Hypatia Message Message Message Hypatia
Message Message Message Hypatia Message Message Message
- 35. 38 Notifications / Messaging {user: Hypatia, ctime:
ISODate(), mtime: ISODate(), count: 10, inbox: [ , , , ] }