Building Your App:    Perl & MongoDB    Mike Friedman (friedo)    Perl Engineer & Evangelist, 10gen    http://friedo.com  ...
10gen, the MongoDB Company               http://www.10gen.com   http://www.mongodb.orgThursday, January 17, 13
What is MongoDB?Thursday, January 17, 13
What is MongoDB?    ✤    Document Oriented DatabaseThursday, January 17, 13
What is MongoDB?    ✤    Document Oriented Database    ✤    Open SourceThursday, January 17, 13
What is MongoDB?    ✤    Document Oriented Database    ✤    Open Source    ✤    High PerformanceThursday, January 17, 13
What is MongoDB?    ✤    Document Oriented Database    ✤    Open Source    ✤    High Performance    ✤    Horizontally Scal...
What is MongoDB?    ✤    Document Oriented Database    ✤    Open Source    ✤    High Performance    ✤    Horizontally Scal...
What We Will Build:    ✤    “Library” - A demo application          ✤    Users          ✤    Books          ✤    Authors  ...
What We Will Need:Thursday, January 17, 13
What We Will Need:    ✤    MongoDB          ✤    http://www.mongodb.org/downloadsThursday, January 17, 13
What We Will Need:    ✤    MongoDB          ✤    http://www.mongodb.org/downloads    ✤    CPAN Modules:          ✤    http...
Inside the MongoDB CPAN    DistributionThursday, January 17, 13
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::MongoClientThursday, January 17, 13
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::MongoClient          ✤    new in version 0.502.Thursday, January ...
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::MongoClient          ✤    new in version 0.502.          ✤    “Sa...
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::MongoClient          ✤    new in version 0.502.          ✤    “Sa...
Inside the MongoDB CPAN    DistributionThursday, January 17, 13
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::Database          ✤    Represents a database (namespace) on the M...
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::Database          ✤    Represents a database (namespace) on the M...
Inside the MongoDB CPAN    Distribution    ✤    MongoDB::Database          ✤    Represents a database (namespace) on the M...
MongoDB DocumentsThursday, January 17, 13
MongoDB Documents    ✤    Documents live in CollectionsThursday, January 17, 13
MongoDB Documents    ✤    Documents live in Collections    ✤    Documents have no pre-defined schemaThursday, January 17, 13
MongoDB Documents    ✤    Documents live in Collections    ✤    Documents have no pre-defined schema    ✤    Documents have...
MongoDB Documents    ✤    Documents live in Collections    ✤    Documents have no pre-defined schema    ✤    Documents have...
MongoDB Documents    ✤    Documents live in Collections    ✤    Documents have no pre-defined schema    ✤    Documents have...
MongoDB Documents                    {                           title: Fellowship of the Ring, The,                      ...
Class Delegation Structure              DocumentsThursday, January 17, 13
Class Delegation Structure              Documents    MongoDB::CursorThursday, January 17, 13
Class Delegation Structure              Documents     MongoDB::Cursor                                      has()          ...
Class Delegation Structure              Documents     MongoDB::Cursor                                      has()          ...
Class Delegation Structure              Documents      MongoDB::Cursor                                       has()        ...
Class Delegation Structure              Documents      MongoDB::Cursor      Application                                   ...
Let’s Build It!Thursday, January 17, 13
Building the LibraryThursday, January 17, 13
Building the LibraryThursday, January 17, 13
Building the LibraryThursday, January 17, 13
Building the LibraryThursday, January 17, 13
Building the Library                                  Remember the Genres?                    {                           ...
Building the LibraryThursday, January 17, 13
Building the LibraryThursday, January 17, 13
Where to go from here?    ✤    Learn more about MongoDB:          ✤    http://docs.mongodb.org/manual/    ✤    Learn more ...
What’s on CPAN?    ✤    ODM’s (Object Document Mappers)          ✤    Like ORMs but simplerThursday, January 17, 13
What’s on CPAN?    ✤    Mongoose:          ✤    Based on MongoMapper               from Ruby.          ✤    MongoDB Docs -...
What’s on CPAN?    ✤    MongoDBI          ✤    Very Perlish          ✤    Moose-like SyntaxThursday, January 17, 13
What’s on CPAN?    ✤    MongoDB::Async          ✤    Tracks upstream MongoDB Distribution          ✤    Uses Coro and libe...
Questions    https://github.com/friedo/mongo-library    http://docs.mongodb.org/manual/    MongoDB::TutorialThursday, Janu...
Upcoming SlideShare
Loading in...5
×

Building a MongoDB App with Perl

3,601

Published on

This presentation covers the very basics of building a simple web application with MongoDB and the Mojolicious::Lite prototyping framework.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
3,601
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
39
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Building a MongoDB App with Perl

  1. 1. Building Your App: Perl & MongoDB Mike Friedman (friedo) Perl Engineer & Evangelist, 10gen http://friedo.com Perl Oasis 2013Thursday, January 17, 13
  2. 2. 10gen, the MongoDB Company http://www.10gen.com http://www.mongodb.orgThursday, January 17, 13
  3. 3. What is MongoDB?Thursday, January 17, 13
  4. 4. What is MongoDB? ✤ Document Oriented DatabaseThursday, January 17, 13
  5. 5. What is MongoDB? ✤ Document Oriented Database ✤ Open SourceThursday, January 17, 13
  6. 6. What is MongoDB? ✤ Document Oriented Database ✤ Open Source ✤ High PerformanceThursday, January 17, 13
  7. 7. What is MongoDB? ✤ Document Oriented Database ✤ Open Source ✤ High Performance ✤ Horizontally ScalableThursday, January 17, 13
  8. 8. What is MongoDB? ✤ Document Oriented Database ✤ Open Source ✤ High Performance ✤ Horizontally Scalable ✤ Full FeaturedThursday, January 17, 13
  9. 9. What We Will Build: ✤ “Library” - A demo application ✤ Users ✤ Books ✤ Authors ✤ PublishersThursday, January 17, 13
  10. 10. What We Will Need:Thursday, January 17, 13
  11. 11. What We Will Need: ✤ MongoDB ✤ http://www.mongodb.org/downloadsThursday, January 17, 13
  12. 12. What We Will Need: ✤ MongoDB ✤ http://www.mongodb.org/downloads ✤ CPAN Modules: ✤ https://metacpan.org/module/Mojolicious::Lite ✤ https://metacpan.org/module/MongoDBThursday, January 17, 13
  13. 13. Inside the MongoDB CPAN DistributionThursday, January 17, 13
  14. 14. Inside the MongoDB CPAN Distribution ✤ MongoDB::MongoClientThursday, January 17, 13
  15. 15. Inside the MongoDB CPAN Distribution ✤ MongoDB::MongoClient ✤ new in version 0.502.Thursday, January 17, 13
  16. 16. Inside the MongoDB CPAN Distribution ✤ MongoDB::MongoClient ✤ new in version 0.502. ✤ “Safe” (write-acknowledged) by defaultThursday, January 17, 13
  17. 17. Inside the MongoDB CPAN Distribution ✤ MongoDB::MongoClient ✤ new in version 0.502. ✤ “Safe” (write-acknowledged) by default ✤ Encapsulates connection and server infoThursday, January 17, 13
  18. 18. Inside the MongoDB CPAN DistributionThursday, January 17, 13
  19. 19. Inside the MongoDB CPAN Distribution ✤ MongoDB::Database ✤ Represents a database (namespace) on the MongoDB serverThursday, January 17, 13
  20. 20. Inside the MongoDB CPAN Distribution ✤ MongoDB::Database ✤ Represents a database (namespace) on the MongoDB server ✤ MongoDB::Collection ✤ Represents a collection (table? kinda) in a databaseThursday, January 17, 13
  21. 21. Inside the MongoDB CPAN Distribution ✤ MongoDB::Database ✤ Represents a database (namespace) on the MongoDB server ✤ MongoDB::Collection ✤ Represents a collection (table? kinda) in a database ✤ MongoDB::Cursor ✤ Retrieves documents (rows? kinda) from a collectionThursday, January 17, 13
  22. 22. MongoDB DocumentsThursday, January 17, 13
  23. 23. MongoDB Documents ✤ Documents live in CollectionsThursday, January 17, 13
  24. 24. MongoDB Documents ✤ Documents live in Collections ✤ Documents have no pre-defined schemaThursday, January 17, 13
  25. 25. MongoDB Documents ✤ Documents live in Collections ✤ Documents have no pre-defined schema ✤ Documents have key-value pairs, like Perl hashesThursday, January 17, 13
  26. 26. MongoDB Documents ✤ Documents live in Collections ✤ Documents have no pre-defined schema ✤ Documents have key-value pairs, like Perl hashes ✤ Documents can have nested structure (arrays and other documents), like Perl hashesThursday, January 17, 13
  27. 27. MongoDB Documents ✤ Documents live in Collections ✤ Documents have no pre-defined schema ✤ Documents have key-value pairs, like Perl hashes ✤ Documents can have nested structure (arrays and other documents), like Perl hashes ✤ Documents look something like JSONThursday, January 17, 13
  28. 28. MongoDB Documents { title: Fellowship of the Ring, The, author: ObjectId("507ffbb1d94ccab2da652597"), language: English, genre: [fantasy, adventure], publication: { name: George Allen & Unwin, location: London, date: new Date(21 July 1954), } }Thursday, January 17, 13
  29. 29. Class Delegation Structure DocumentsThursday, January 17, 13
  30. 30. Class Delegation Structure Documents MongoDB::CursorThursday, January 17, 13
  31. 31. Class Delegation Structure Documents MongoDB::Cursor has() MongoDB::CollectionThursday, January 17, 13
  32. 32. Class Delegation Structure Documents MongoDB::Cursor has() MongoDB::Collection has() MongoDB::DatabaseThursday, January 17, 13
  33. 33. Class Delegation Structure Documents MongoDB::Cursor has() MongoDB::Collection has() MongoDB::Database has() MongoDB::MongoClientThursday, January 17, 13
  34. 34. Class Delegation Structure Documents MongoDB::Cursor Application has() MongoDB::Collection has() MongoDB::Database has() MongoDB::MongoClientThursday, January 17, 13
  35. 35. Let’s Build It!Thursday, January 17, 13
  36. 36. Building the LibraryThursday, January 17, 13
  37. 37. Building the LibraryThursday, January 17, 13
  38. 38. Building the LibraryThursday, January 17, 13
  39. 39. Building the LibraryThursday, January 17, 13
  40. 40. Building the Library Remember the Genres? { title: Fellowship of the Ring, The, author: ObjectId("507ffbb1d94ccab2da652597"), language: English, genre: [fantasy, adventure], publication: { name: George Allen & Unwin, location: London, date: new Date(21 July 1954), } }Thursday, January 17, 13
  41. 41. Building the LibraryThursday, January 17, 13
  42. 42. Building the LibraryThursday, January 17, 13
  43. 43. Where to go from here? ✤ Learn more about MongoDB: ✤ http://docs.mongodb.org/manual/ ✤ Learn more about the MongoDB Perl API ✤ https://metacpan.org/module/MongoDB::Tutorial ✤ Hack on the Library demo app ✤ https://github.com/friedo/mongo-library ✤ Add/edit authors? ✤ Edit books?Thursday, January 17, 13
  44. 44. What’s on CPAN? ✤ ODM’s (Object Document Mappers) ✤ Like ORMs but simplerThursday, January 17, 13
  45. 45. What’s on CPAN? ✤ Mongoose: ✤ Based on MongoMapper from Ruby. ✤ MongoDB Docs --> Moose objects.Thursday, January 17, 13
  46. 46. What’s on CPAN? ✤ MongoDBI ✤ Very Perlish ✤ Moose-like SyntaxThursday, January 17, 13
  47. 47. What’s on CPAN? ✤ MongoDB::Async ✤ Tracks upstream MongoDB Distribution ✤ Uses Coro and libev for asynchronous queries ✤ (Mostly) drop-in replacement for MongoDB driverThursday, January 17, 13
  48. 48. Questions https://github.com/friedo/mongo-library http://docs.mongodb.org/manual/ MongoDB::TutorialThursday, January 17, 13
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×