SlideShare a Scribd company logo
Pablo Godel @pgodel - 2012.phpDay.it
         May 18th 2012 - Verona, Italy
             https://joind.in/6383




Friday, May 18, 2012
Who Am I?

     ⁃ Born in Argentina, living in the US since 1999
     ⁃ PHP & Symfony developer
     ⁃ Founder of the original PHP mailing list in spanish
     ⁃ Master of the parrilla




Friday, May 18, 2012
Who Am I?

     ⁃ Born in Argentina, living in the US since 1999
     ⁃ PHP & Symfony developer
     ⁃ Founder of the original PHP mailing list in spanish
     ⁃ Master of the parrilla




Friday, May 18, 2012
Friday, May 18, 2012
ServerGrove!


      ⁃ Founded ServerGrove Networks in 2005

      ⁃ Provider of web hosting specialized in PHP,
        Symfony, ZendFramework, and others

      ⁃ Mongohosting.com under beta!




Friday, May 18, 2012
Community is our teacher


            ⁃ Very active open source supporter through code
              contributions and usergroups/conference sponsoring




Friday, May 18, 2012
Agenda




     - Introduction to MongoDB
     - PHP and MongoDB
     - PHP Libraries
     - Symfony2 and MongoDB




Friday, May 18, 2012
What is MongoDB?




                        Who is 10Gen?




Friday, May 18, 2012
Mongo
                       Mongo as in "humongous". Used to describe
                       something extremely large or important.




Friday, May 18, 2012
MongoDB is a scalable, high-performance,
            open source NoSQL database.

    - Document Oriented DB
    - Written in C++
    - Available for *nux (Linux, Solaris, etc),
       Windows and OS X
    - Lots of Drivers (PHP, Java, Python, Ruby...)




Friday, May 18, 2012
Features

          - Flexible JSON-style documents
          - Full Indexing
          - Complex Queries / Map Reduce
          - Aggregation Framework (coming soon)
          - GridFS (store files natively)
          - Multiple Replication Options
          - Sharding
          - Simple Installation / Zero Config




Friday, May 18, 2012
Document Oriented


 Coming from SQL?




                             Database => Database
                             Table => Collection
                             Row => Document




Friday, May 18, 2012
JSON-style documents
    {
         name: {
                   first: 'John',
                   last: 'Doe'
                  },
         title: 'Engineer',
         age: 40
  }




Friday, May 18, 2012
No Schema or fixed tables

     {
          name: {
                    first: 'Foo',
                    last: 'Bar'
                   },
          title: 'Student',
          school: 'Harvard'
  }




Friday, May 18, 2012
Embedded documents
   {
    "_id" : ObjectId("4ccba15ef597e9352e060000")
    "srcFilename" : "/etc/apache2/sites-enabled/example1.com",
    "vhostDirective" :
          { "directives" : [
                       {
                           "name" : "CustomLog",
                           "value" : "logs/example1.com-access_log combined"
                         },
                       {
                          "name" : "DocumentRoot",
                          "value" : "/var/www/vhosts/example1.com/httpdocs"
                       },
                       {
                          "name" : "ServerName",
                          "value" : "example1.com"
                       }
                     ]
           }
   }




Friday, May 18, 2012
Document Referencing
    {
    "_id" : ObjectId("4cc4a5c3f597e9db6e010109"),
    "billingId" : NumberLong(650),
    "created" : ISODate("2010-10-24T21:31:47Z"),
    "servers" : [
       {
         "$ref" : "server",
         "$id" : ObjectId("4cc4a5c4f597e9db6e050201")
       }
    ],
    "users" : [
       {
         "$ref" : "user",
         "$id" : ObjectId("4cc4a5c4f597e9db6e980201")
       },
       {
         "$ref" : "user",
         "$id" : ObjectId("4cc4a5c4f597e9db6e9c0201")
       }
    ]
    }



Friday, May 18, 2012
Full Indexing



                  db.coll.ensureIndex({name.last: 1})

                  db.coll.ensureIndex({name.first: 1, name.last: 1})

                  db.coll.ensureIndex({age: 0})




Friday, May 18, 2012
Querying



                       db.coll.find({name: 'John'})

                       db.coll.find({keywords: 'storage'})

                       db.coll.find({keywords: {$in: ['storage', 'DBMS']}}




Friday, May 18, 2012
GridFS




                       - Files are divided in chunks
                         and stored over multiple documents

                       - Transparent API




Friday, May 18, 2012
Replication




                       Source: http://www.mongodb.org/display/DOCS/Replication

Friday, May 18, 2012
Shards




                       Source: http://www.mongodb.org/display/DOCS/Introduction

Friday, May 18, 2012
Simple Installation/Zero Config



                                 OS X


        wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.4.tgz

        tar zxvf mongodb-osx-x86_64-2.0.4.tgz

        cd mongodb-osx-x86_64-2.0.4

        ./mongod




Friday, May 18, 2012
Simple Installation/Zero Config


                                   CentOS Linux
  /etc/yum.repos.d/10gen.repo

  [10gen]
  name=10gen Repository
  baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
  gpgcheck=0



  $ yum install -y mongo-stable-server
  $ service mongod start




Friday, May 18, 2012
Why is MongoDB good for Rapid
                       Development of Web Apps?




Friday, May 18, 2012
Rapid Development
                       Schema-less / Document Oriented

                                                  FLEXIBILITY




     by exfordy




Friday, May 18, 2012
Rapid Development
                       Schema-less / Document Oriented

                                                 EASIER
                                                 MIGRATIONS




     by exfordy




Friday, May 18, 2012
Rapid Development

                                   NO JOINS!




Friday, May 18, 2012
Performance

                                       SPEED




       by xavi talleda




Friday, May 18, 2012
Performance

                                                  SCALABILITY




     by Jimee, Jackie, Tom & Asha




Friday, May 18, 2012
A Word of Caution




                                       No Transactions
                                        No Rollbacks
                                       Unsafe defaults
                                      Map Reduce locks




      by Ernst Vikne




Friday, May 18, 2012
Great Use Cases


                       - Content Management

                       - Product Catalogs

                       - Realtime Analytics

                       - Logs Storage




Friday, May 18, 2012
and




Friday, May 18, 2012
PECL driver

 Linux
 pecl install mongo
 echo “extension=mongo.so >> /path/php.ini”



 OS X
 http://php-osx.liip.ch/


 Windows
 https://github.com/mongodb/mongo-php-driver/downloads



Friday, May 18, 2012
Usage
 <?php
 // connect
 $m = new Mongo();
 // select a database
 $db = $m->comedy;
 // select a collection (analogous to a relational database's table)
 $collection = $db->cartoons;
 // add a record
 $obj = array
 ( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
 $collection->insert($obj);
 // add another record, with a different "shape"
 $obj = array( "title" => "XKCD", "online" => true );
 $collection->insert($obj);
 // find everything in the collection
 $cursor = $collection->find();
 // iterate through the results
 foreach ($cursor as $obj) {
     echo $obj["title"] . "n";
 }
 ?>


Friday, May 18, 2012
Storing Files
           <?php

           // save a file
           $id = $grid->storeFile("game.tgz");
           $game = $grid->findOne();

           // add a downloads counter
           $game->file['downloads'] = 0;
           $grid->save($game->file);

           // increment the counter
           $grid->update(array("_id" => $id), array('$inc' => array
           ("downloads" => 1)));

           ?>




Friday, May 18, 2012
SQL to Mongo Queries
                       SQL to Mongo Mapping Chart
                       This is a PHP-specific version of the » SQL to Mongo mapping chart in the main docs.



                                                                    SQL Statement
                                                           Mongo Query Language Statement
                       CREATE TABLE USERS (a Number, b Number)
                       Implicit or use MongoDB::createCollection().
                       INSERT INTO USERS VALUES(1,1)
                       $db->users->insert(array("a" => 1, "b" => 1));
                       SELECT a,b FROM users
                       $db->users->find(array(), array("a" => 1, "b" => 1));
                       SELECT * FROM users WHERE age=33
                       $db->users->find(array("age" => 33));
                       SELECT a,b FROM users WHERE age=33
                       $db->users->find(array("age" => 33), array("a" => 1, "b" => 1));
                       SELECT a,b FROM users WHERE age=33 ORDER BY name
                       $db->users->find(array("age" => 33), array("a" => 1, "b" => 1))->sort(array("name" => 1));
                       SELECT * FROM users WHERE age>33
                       $db->users->find(array("age" => array('$gt' => 33)));
                       SELECT * FROM users WHERE age<33
                       $db->users->find(array("age" => array('$lt' => 33)));
                       SELECT * FROM users WHERE name LIKE "%Joe%"
                       $db->users->find(array("name" => new MongoRegex("/Joe/")));
                       SELECT * FROM users WHERE name LIKE "Joe%"
                       $db->users->find(array("name" => new MongoRegex("/^Joe/")));
                       SELECT * FROM users WHERE age>33 AND age<=40
                       $db->users->find(array("age" => array('$gt' => 33, '$lte' => 40)));
                       SELECT * FROM users ORDER BY name DESC



                http://php.net/manual/en/mongo.sqltomongo.php


Friday, May 18, 2012
Admin Interfaces


          - Genghis
            http://genghisapp.com/

          - RockMongo
            http://code.google.com/p/rock-php/wiki/rock_mongo

          - php-mongodb-admin
            https://github.com/jwage/php-mongodb-admin




Friday, May 18, 2012
PHP Libraries




                       - Doctrine ODM

                       - Mandango

                       - many more...




Friday, May 18, 2012
Doctrine MongoDB ODM



                       http://doctrine-project.org

    Doctrine MongoDB Object Document Mapper is
     built for PHP 5.3.2+ and provides transparent
               persistence for PHP objects.



Friday, May 18, 2012
Doctrine MongoDB ODM
  /** @Document */
  class User
  {
      /** @Id */
      private $id;

            /** @String */
            private $name;

            /** @String */
            private $email;

            /** @ReferenceMany(targetDocument="BlogPost", cascade="all") */
            private $posts = array();

            // ...
  }




Friday, May 18, 2012
Doctrine MongoDB ODM
  /** @Document */
  class BlogPost
  {
      /** @Id */
      private $id;

            /** @String */
            private $title;

            /** @String */
            private $body;

            /** @Date */
            private $createdAt;

            // ...
  }




Friday, May 18, 2012
Doctrine MongoDB ODM
  <?php

  // create user
  $user = new User();
  $user->setName('Bulat S.');
  $user->setEmail('email@example.com');

  // tell Doctrine 2 to save $user on the next flush()
  $dm->persist($user);

  // create blog post
  $post = new BlogPost();
  $post->setTitle('My First Blog Post');
  $post->setBody('MongoDB + Doctrine 2 ODM = awesomeness!');
  $post->setCreatedAt(new DateTime());

  $user->addPost($post);

  // store everything to MongoDB
  $dm->flush();




Friday, May 18, 2012
Doctrine MongoDB ODM

  Array
  (
      [_id] => 4bec5869fdc212081d000000
      [title] => My First Blog Post
      [body] => MongoDB + Doctrine 2 ODM = awesomeness!
      [createdAt] => MongoDate Object
          (
              [sec] => 1273723200
              [usec] => 0
          )
  )




Friday, May 18, 2012
Doctrine MongoDB ODM
  Array
  (
      [_id] => 4bec5869fdc212081d010000
      [name] => Bulat S.
      [email] => email@example.com
      [posts] => Array
          (
              [0] => Array
                  (
                       [$ref] => blog_posts
                       [$id] => 4bec5869fdc212081d000000
                       [$db] => test_database
                  )
          )
  )




Friday, May 18, 2012
Doctrine MongoDB ODM

  $user = $dm->find('User', $userId);

  $user = $dm->getRepository('User')->findOneByName('Bulat S.');

  $posts = $user->getPosts();
  foreach ($posts as $post) {
     echo $post;
  }




Friday, May 18, 2012
Doctrine MongoDB ODM
  Document Repositories
  // src/YourNamespace/YourBundle/ServerRepository.php
  namespace YourNamespaceYourBundle;

  use DoctrineODMMongoDBDocumentRepository;

  class ServerRepository extends DocumentRepository
  {
      public function getActiveServers()
      {
          return $this->createQueryBuilder()
                  ->field('isActive')->equals(true)
                  ->sort('name', 'asc')->getQuery()->execute();
      }



  Usage
  $rep = $dm->getRepository(‘@YourBundle/Server’);
  $servers = $rep->getActiveServers();


Friday, May 18, 2012
Doctrine MongoDB ODM
  /** @Document */
  class Image
  {
      /** @Id */
      private $id;

            /** @Field */
            private $name;

            /** @File */
            private $file;




Friday, May 18, 2012
Doctrine MongoDB ODM
  // store file
  $image = new Image();
  $image->setName('Test image');
  $image->setFile('/path/to/image.png');

  $dm->persist($image);
  $dm->flush();


  // retrieve and return file to client
  $image = $dm->createQueryBuilder('DocumentsImage')
      ->field('name')->equals('Test image')
      ->getQuery()
      ->getSingleResult();

  header('Content-type: image/png;');
  echo $image->getFile()->getBytes();




Friday, May 18, 2012
Symfony is a PHP Web Development Framework.



Friday, May 18, 2012
Symfony2 Bundles


                       - DoctrineMongoDBBundle


                       - MandangoBundle




Friday, May 18, 2012
DoctrineMongoDBBundle

                Installation with Composer

                composer.json
                {
                       require: {
                           "doctrine/mongodb-odm-bundle": "dev-master"
                       }
                }




                 $ php composer.phar update




Friday, May 18, 2012
DoctrineMongoDBBundle
  Configuring Symfony2


  app/autoload.php
 use DoctrineCommonAnnotationsAnnotationRegistry;

 AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine-
 mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/
 DoctrineAnnotations.php');




Friday, May 18, 2012
DoctrineMongoDBBundle
 Configuring Symfony2

 app/config/config.yml
 doctrine_mongodb:
     connections:
         default:
             server: mongodb://localhost:27017
             options:
                  connect: true
     default_database: test_database
     document_managers:
         default:
             auto_mapping: true




Friday, May 18, 2012
DoctrineMongoDBBundle
  app/config/config.yml
 doctrine_mongodb:
     connections:
         default:
             server: mongodb://localhost:27017
             options:
                  connect: true

         usage:
             server: mongodb://user:pass@db1.mongohosting.com:27017
             options:
                  replicaSet: true
                  connect: true
     default_database: test_database
     document_managers:
         default:
             mappings:
                SGCBundle: ~
                SGCRepositoryAppBundle: yml
                MyBundle: { type: xml, dir: Resources/config/doctrine/
 mapping }


Friday, May 18, 2012
DoctrineMongoDBBundle
 Defining Documents




Friday, May 18, 2012
DoctrineMongoDBBundle
 Defining Documents
 // src/Acme/StoreBundle/Document/Product.php
 namespace AcmeStoreBundleDocument;

 use DoctrineODMMongoDBMappingAnnotations as MongoDB;

 /**
   * @MongoDBDocument(collection="product")
   */
 class Product
 {
      /**
       * @MongoDBId
       */
      protected $id;

            /**
             * @MongoDBString @MongoDBIndex(unique=true, order="asc")
             */
            protected $name;



Friday, May 18, 2012
DoctrineMongoDBBundle
 Using Documents
 // src/Acme/StoreBundle/Controller/DefaultController.php
 use AcmeStoreBundleDocumentProduct;
 use SymfonyComponentHttpFoundationResponse;
 // ...

 public function createAction()
 {
     $product = new Product();
     $product->setName('A Foo Bar');
     $product->setPrice('19.99');

            $dm = $this->get('doctrine.odm.mongodb.document_manager');
            $dm->persist($product);
            $dm->flush();

            return new Response('Created product id '.$product->getId());
 }




Friday, May 18, 2012
Forms
        Since Documents are Plain PHP Objects integrating it with Symfony Forms is straightforward.

   public function createAction()
   {
       $dm = $this->get
   ('doctrine.odm.mongodb.default_document_manager');

       $form = $this->createForm(new RegistrationType(), new
   Registration());

             $form->bindRequest($this->getRequest());

             if ($form->isValid()) {
                 $registration = $form->getData();

                       $dm->persist($registration->getUser());
                       $dm->flush();

                       return $this->redirect(...);
             }
                       http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/form.html




Friday, May 18, 2012
Commands

  Symfony2 Commands
 doctrine
   doctrine:mongodb:cache:clear-metadata    Clear all metadata cache for a document manager.
   doctrine:mongodb:fixtures:load           Load data fixtures to your database.
   doctrine:mongodb:generate:documents      Generate document classes and method stubs from
 your mapping information.
   doctrine:mongodb:generate:hydrators      Generates hydrator classes for document classes.
   doctrine:mongodb:generate:proxies        Generates proxy classes for document classes.
   doctrine:mongodb:generate:repositories   Generate repository classes from your mapping
 information.
   doctrine:mongodb:mapping:info            Show basic information about all mapped
 documents.
   doctrine:mongodb:query                   Query mongodb and inspect the outputted results
 from your document classes.
   doctrine:mongodb:schema:create           Allows you to create databases, collections and
 indexes for your documents
   doctrine:mongodb:schema:drop             Allows you to drop databases, collections and
 indexes for your documents




Friday, May 18, 2012
Bundles using MongoDB


                - SonataDoctrineMongoDBAdminBundle

                - IsmaAmbrosiGeneratorBundle

                - EbutikMongoSessionBundle

                - TranslationEditorBundle

                - ServerGroveLiveChat



Friday, May 18, 2012
Questions?




Friday, May 18, 2012
Thank you!




                 Rate Me Please! https://joind.in/6383
                      Slides: http://slideshare.net/pgodel
                               Twitter: @pgodel
                       E-mail: pablo@servergrove.com
Friday, May 18, 2012

More Related Content

Viewers also liked (20)

Developing Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDBDeveloping Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDB
MongoDB
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Alessandro Nadalin
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
Pablo Godel
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and Symfony
Pablo Godel
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2
Pablo Godel
 
Doctrine in the Real World
Doctrine in the Real WorldDoctrine in the Real World
Doctrine in the Real World
Jonathan Wage
 
Persisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapperPersisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapper
wonko
 
Getting started with MongoDB and PHP
Getting started with MongoDB and PHPGetting started with MongoDB and PHP
Getting started with MongoDB and PHP
gates10gen
 
Serving Images with GridFS
Serving Images with GridFSServing Images with GridFS
Serving Images with GridFS
Mark Smalley
 
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM EntitiesUpload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
MongoDB
 
Starting with Symfony2
Starting with Symfony2Starting with Symfony2
Starting with Symfony2
Kevin Bond
 
Symfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 IntegrationSymfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 Integration
Jonathan Wage
 
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Ontico
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UK
Ricard Clau
 
A Practical Introduction to Symfony2
A Practical Introduction to Symfony2A Practical Introduction to Symfony2
A Practical Introduction to Symfony2
Kris Wallsmith
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 Developers
Marcin Chwedziak
 
Symfony2 and AngularJS
Symfony2 and AngularJSSymfony2 and AngularJS
Symfony2 and AngularJS
Antonio Peric-Mazar
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
 
Backtoschoolnight
BacktoschoolnightBacktoschoolnight
Backtoschoolnight
hdaleo
 
A Last Look Day 3
A Last Look Day 3A Last Look Day 3
A Last Look Day 3
jmori1
 
Developing Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDBDeveloping Web Apps with Symfony2, Doctrine and MongoDB
Developing Web Apps with Symfony2, Doctrine and MongoDB
MongoDB
 
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Hey, I just met AngularJS, and this is crazy, so here’s my JavaScript, let’s ...
Alessandro Nadalin
 
Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013   Symfony2 and MongoDB - MidwestPHP 2013
Symfony2 and MongoDB - MidwestPHP 2013
Pablo Godel
 
Tek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and SymfonyTek13 - Creating Mobile Apps with PHP and Symfony
Tek13 - Creating Mobile Apps with PHP and Symfony
Pablo Godel
 
Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2Creating Mobile Apps With PHP & Symfony2
Creating Mobile Apps With PHP & Symfony2
Pablo Godel
 
Doctrine in the Real World
Doctrine in the Real WorldDoctrine in the Real World
Doctrine in the Real World
Jonathan Wage
 
Persisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapperPersisting dynamic data with mongodb and mongomapper
Persisting dynamic data with mongodb and mongomapper
wonko
 
Getting started with MongoDB and PHP
Getting started with MongoDB and PHPGetting started with MongoDB and PHP
Getting started with MongoDB and PHP
gates10gen
 
Serving Images with GridFS
Serving Images with GridFSServing Images with GridFS
Serving Images with GridFS
Mark Smalley
 
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM EntitiesUpload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
Upload Files to MongoDB GridFS with Symfony2 and Combine Them with ORM Entities
MongoDB
 
Starting with Symfony2
Starting with Symfony2Starting with Symfony2
Starting with Symfony2
Kevin Bond
 
Symfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 IntegrationSymfony2 and Doctrine2 Integration
Symfony2 and Doctrine2 Integration
Jonathan Wage
 
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)Шардинг в MongoDB, Henrik Ingo (MongoDB)
Шардинг в MongoDB, Henrik Ingo (MongoDB)
Ontico
 
Scaling with Symfony - PHP UK
Scaling with Symfony - PHP UKScaling with Symfony - PHP UK
Scaling with Symfony - PHP UK
Ricard Clau
 
A Practical Introduction to Symfony2
A Practical Introduction to Symfony2A Practical Introduction to Symfony2
A Practical Introduction to Symfony2
Kris Wallsmith
 
Effective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 DevelopersEffective Doctrine2: Performance Tips for Symfony2 Developers
Effective Doctrine2: Performance Tips for Symfony2 Developers
Marcin Chwedziak
 
Speed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with RedisSpeed up your Symfony2 application and build awesome features with Redis
Speed up your Symfony2 application and build awesome features with Redis
Ricard Clau
 
Backtoschoolnight
BacktoschoolnightBacktoschoolnight
Backtoschoolnight
hdaleo
 
A Last Look Day 3
A Last Look Day 3A Last Look Day 3
A Last Look Day 3
jmori1
 

Similar to Symfony2 and MongoDB (20)

Open source Technology
Open source TechnologyOpen source Technology
Open source Technology
Amardeep Vishwakarma
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
John Ballinger
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
Alex Sharp
 
MongoDB - Who, What & Where!
MongoDB - Who, What & Where!MongoDB - Who, What & Where!
MongoDB - Who, What & Where!
Mark Hillick
 
Everyday - mongodb
Everyday - mongodbEveryday - mongodb
Everyday - mongodb
elliando dias
 
Drop acid
Drop acidDrop acid
Drop acid
Mike Feltman
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
Mongo db basics
Mongo db basicsMongo db basics
Mongo db basics
Claudio Montoya
 
Mongodb (1)
Mongodb (1)Mongodb (1)
Mongodb (1)
Deepak Kumar
 
Grails and MongoDB - what, why and how
Grails and MongoDB - what, why and howGrails and MongoDB - what, why and how
Grails and MongoDB - what, why and how
Iure Guimaraes
 
Mongo NYC PHP Development
Mongo NYC PHP Development Mongo NYC PHP Development
Mongo NYC PHP Development
Fitz Agard
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
Spyros Passas
 
Mongo db
Mongo dbMongo db
Mongo db
Gyanendra Yadav
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
foliba
 
MongoDB Internals
MongoDB InternalsMongoDB Internals
MongoDB Internals
Siraj Memon
 
Using NoSQL with Yo' SQL
Using NoSQL with Yo' SQLUsing NoSQL with Yo' SQL
Using NoSQL with Yo' SQL
Rich Thornett
 
Mongo DB
Mongo DB Mongo DB
Mongo DB
Tata Consultancy Services
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf
 
mongodb_DS.pptx
mongodb_DS.pptxmongodb_DS.pptx
mongodb_DS.pptx
DavoudSalehi1
 
Einführung in MongoDB
Einführung in MongoDBEinführung in MongoDB
Einführung in MongoDB
NETUserGroupBern
 
Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4Bar Camp Auckland - Mongo DB Presentation BCA4
Bar Camp Auckland - Mongo DB Presentation BCA4
John Ballinger
 
Intro To MongoDB
Intro To MongoDBIntro To MongoDB
Intro To MongoDB
Alex Sharp
 
MongoDB - Who, What & Where!
MongoDB - Who, What & Where!MongoDB - Who, What & Where!
MongoDB - Who, What & Where!
Mark Hillick
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Justin Smestad
 
Grails and MongoDB - what, why and how
Grails and MongoDB - what, why and howGrails and MongoDB - what, why and how
Grails and MongoDB - what, why and how
Iure Guimaraes
 
Mongo NYC PHP Development
Mongo NYC PHP Development Mongo NYC PHP Development
Mongo NYC PHP Development
Fitz Agard
 
Mongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappeMongo db php_shaken_not_stirred_joomlafrappe
Mongo db php_shaken_not_stirred_joomlafrappe
Spyros Passas
 
Mongo db transcript
Mongo db transcriptMongo db transcript
Mongo db transcript
foliba
 
MongoDB Internals
MongoDB InternalsMongoDB Internals
MongoDB Internals
Siraj Memon
 
Using NoSQL with Yo' SQL
Using NoSQL with Yo' SQLUsing NoSQL with Yo' SQL
Using NoSQL with Yo' SQL
Rich Thornett
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf
 
Ad

More from Pablo Godel (20)

SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSky
Pablo Godel
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Pablo Godel
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSky
Pablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
Pablo Godel
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
Pablo Godel
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Pablo Godel
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
Pablo Godel
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
Pablo Godel
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
Pablo Godel
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Pablo Godel
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
Pablo Godel
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
Pablo Godel
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Pablo Godel
 
Soflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developersSoflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developers
Pablo Godel
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
Pablo Godel
 
Codeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP AppsCodeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP Apps
Pablo Godel
 
PFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP AppsPFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP Apps
Pablo Godel
 
Declare independence from your it department sysadmin skills for symfony dev...
Declare independence from your it department  sysadmin skills for symfony dev...Declare independence from your it department  sysadmin skills for symfony dev...
Declare independence from your it department sysadmin skills for symfony dev...
Pablo Godel
 
SymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSkySymfonyCon Cluj 2017 - Symfony at OpenSky
SymfonyCon Cluj 2017 - Symfony at OpenSky
Pablo Godel
 
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSkySymfony Live San Francisco 2017 - Symfony @ OpenSky
Symfony Live San Francisco 2017 - Symfony @ OpenSky
Pablo Godel
 
DeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSkyDeSymfony 2017 - Symfony en OpenSky
DeSymfony 2017 - Symfony en OpenSky
Pablo Godel
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
Pablo Godel
 
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony AppsSymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
SymfonyCon Madrid 2014 - Rock Solid Deployment of Symfony Apps
Pablo Godel
 
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceARLa Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
La Caja de Herramientas del Desarrollador Moderno PHPConferenceAR
Pablo Godel
 
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 -  Rock Solid Deployment of Symfony AppsSymfony Live NYC 2014 -  Rock Solid Deployment of Symfony Apps
Symfony Live NYC 2014 - Rock Solid Deployment of Symfony Apps
Pablo Godel
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
Pablo Godel
 
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
PHP Conference Argentina 2013 - Independizate de tu departamento IT - Habilid...
Pablo Godel
 
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balasPHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
PHP Conference Argentina 2013 - Deployment de aplicaciones PHP a prueba de balas
Pablo Godel
 
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP appsphp[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
php[architect] Summit Series DevOps 2013 - Rock solid deployment of PHP apps
Pablo Godel
 
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP DevelopersLone Star PHP 2013 - Sysadmin Skills for PHP Developers
Lone Star PHP 2013 - Sysadmin Skills for PHP Developers
Pablo Godel
 
Lone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New AngleLone StarPHP 2013 - Building Web Apps from a New Angle
Lone StarPHP 2013 - Building Web Apps from a New Angle
Pablo Godel
 
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...deSymfony 2013 -  Creando aplicaciones web desde otro ángulo con Symfony y A...
deSymfony 2013 - Creando aplicaciones web desde otro ángulo con Symfony y A...
Pablo Godel
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Pablo Godel
 
Soflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developersSoflophp 2013 - SysAdmin skills for PHP developers
Soflophp 2013 - SysAdmin skills for PHP developers
Pablo Godel
 
Rock Solid Deployment of Web Applications
Rock Solid Deployment of Web ApplicationsRock Solid Deployment of Web Applications
Rock Solid Deployment of Web Applications
Pablo Godel
 
Codeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP AppsCodeworks'12 Rock Solid Deployment of PHP Apps
Codeworks'12 Rock Solid Deployment of PHP Apps
Pablo Godel
 
PFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP AppsPFCongres 2012 - Rock Solid Deployment of PHP Apps
PFCongres 2012 - Rock Solid Deployment of PHP Apps
Pablo Godel
 
Declare independence from your it department sysadmin skills for symfony dev...
Declare independence from your it department  sysadmin skills for symfony dev...Declare independence from your it department  sysadmin skills for symfony dev...
Declare independence from your it department sysadmin skills for symfony dev...
Pablo Godel
 
Ad

Recently uploaded (20)

Evaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical ContentEvaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical Content
Paul Groth
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Extend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptxExtend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptx
hoang971
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
IntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdfIntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdf
Luiz Carneiro
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdfTop 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
SOFTTECHHUB
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any ApplicationData Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
The case for on-premises AI
The case for on-premises AIThe case for on-premises AI
The case for on-premises AI
Principled Technologies
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 
Evaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical ContentEvaluation Challenges in Using Generative AI for Science & Technical Content
Evaluation Challenges in Using Generative AI for Science & Technical Content
Paul Groth
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
Extend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptxExtend-Microsoft365-with-Copilot-agents.pptx
Extend-Microsoft365-with-Copilot-agents.pptx
hoang971
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
IntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdfIntroSlides-May-BuildWithAi-EarthEngine.pdf
IntroSlides-May-BuildWithAi-EarthEngine.pdf
Luiz Carneiro
 
Jeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software DeveloperJeremy Millul - A Talented Software Developer
Jeremy Millul - A Talented Software Developer
Jeremy Millul
 
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdfTop 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
Top 25 AI Coding Agents for Vibe Coders to Use in 2025.pdf
SOFTTECHHUB
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
Data Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any ApplicationData Virtualization: Bringing the Power of FME to Any Application
Data Virtualization: Bringing the Power of FME to Any Application
Safe Software
 
Securiport - A Border Security Company
Securiport  -  A Border Security CompanySecuriport  -  A Border Security Company
Securiport - A Border Security Company
Securiport
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Create Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent BuilderCreate Your First AI Agent with UiPath Agent Builder
Create Your First AI Agent with UiPath Agent Builder
DianaGray10
 
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptxISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
ISOIEC 42005 Revolutionalises AI Impact Assessment.pptx
AyilurRamnath1
 
TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025TimeSeries Machine Learning - PyData London 2025
TimeSeries Machine Learning - PyData London 2025
Suyash Joshi
 

Symfony2 and MongoDB

  • 1. Pablo Godel @pgodel - 2012.phpDay.it May 18th 2012 - Verona, Italy https://joind.in/6383 Friday, May 18, 2012
  • 2. Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrilla Friday, May 18, 2012
  • 3. Who Am I? ⁃ Born in Argentina, living in the US since 1999 ⁃ PHP & Symfony developer ⁃ Founder of the original PHP mailing list in spanish ⁃ Master of the parrilla Friday, May 18, 2012
  • 5. ServerGrove! ⁃ Founded ServerGrove Networks in 2005 ⁃ Provider of web hosting specialized in PHP, Symfony, ZendFramework, and others ⁃ Mongohosting.com under beta! Friday, May 18, 2012
  • 6. Community is our teacher ⁃ Very active open source supporter through code contributions and usergroups/conference sponsoring Friday, May 18, 2012
  • 7. Agenda - Introduction to MongoDB - PHP and MongoDB - PHP Libraries - Symfony2 and MongoDB Friday, May 18, 2012
  • 8. What is MongoDB? Who is 10Gen? Friday, May 18, 2012
  • 9. Mongo Mongo as in "humongous". Used to describe something extremely large or important. Friday, May 18, 2012
  • 10. MongoDB is a scalable, high-performance, open source NoSQL database. - Document Oriented DB - Written in C++ - Available for *nux (Linux, Solaris, etc), Windows and OS X - Lots of Drivers (PHP, Java, Python, Ruby...) Friday, May 18, 2012
  • 11. Features - Flexible JSON-style documents - Full Indexing - Complex Queries / Map Reduce - Aggregation Framework (coming soon) - GridFS (store files natively) - Multiple Replication Options - Sharding - Simple Installation / Zero Config Friday, May 18, 2012
  • 12. Document Oriented Coming from SQL? Database => Database Table => Collection Row => Document Friday, May 18, 2012
  • 13. JSON-style documents { name: { first: 'John', last: 'Doe' }, title: 'Engineer', age: 40 } Friday, May 18, 2012
  • 14. No Schema or fixed tables { name: { first: 'Foo', last: 'Bar' }, title: 'Student', school: 'Harvard' } Friday, May 18, 2012
  • 15. Embedded documents { "_id" : ObjectId("4ccba15ef597e9352e060000") "srcFilename" : "/etc/apache2/sites-enabled/example1.com", "vhostDirective" : { "directives" : [ { "name" : "CustomLog", "value" : "logs/example1.com-access_log combined" }, { "name" : "DocumentRoot", "value" : "/var/www/vhosts/example1.com/httpdocs" }, { "name" : "ServerName", "value" : "example1.com" } ] } } Friday, May 18, 2012
  • 16. Document Referencing { "_id" : ObjectId("4cc4a5c3f597e9db6e010109"), "billingId" : NumberLong(650), "created" : ISODate("2010-10-24T21:31:47Z"), "servers" : [ { "$ref" : "server", "$id" : ObjectId("4cc4a5c4f597e9db6e050201") } ], "users" : [ { "$ref" : "user", "$id" : ObjectId("4cc4a5c4f597e9db6e980201") }, { "$ref" : "user", "$id" : ObjectId("4cc4a5c4f597e9db6e9c0201") } ] } Friday, May 18, 2012
  • 17. Full Indexing db.coll.ensureIndex({name.last: 1}) db.coll.ensureIndex({name.first: 1, name.last: 1}) db.coll.ensureIndex({age: 0}) Friday, May 18, 2012
  • 18. Querying db.coll.find({name: 'John'}) db.coll.find({keywords: 'storage'}) db.coll.find({keywords: {$in: ['storage', 'DBMS']}} Friday, May 18, 2012
  • 19. GridFS - Files are divided in chunks and stored over multiple documents - Transparent API Friday, May 18, 2012
  • 20. Replication Source: http://www.mongodb.org/display/DOCS/Replication Friday, May 18, 2012
  • 21. Shards Source: http://www.mongodb.org/display/DOCS/Introduction Friday, May 18, 2012
  • 22. Simple Installation/Zero Config OS X wget http://fastdl.mongodb.org/osx/mongodb-osx-x86_64-2.0.4.tgz tar zxvf mongodb-osx-x86_64-2.0.4.tgz cd mongodb-osx-x86_64-2.0.4 ./mongod Friday, May 18, 2012
  • 23. Simple Installation/Zero Config CentOS Linux /etc/yum.repos.d/10gen.repo [10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0 $ yum install -y mongo-stable-server $ service mongod start Friday, May 18, 2012
  • 24. Why is MongoDB good for Rapid Development of Web Apps? Friday, May 18, 2012
  • 25. Rapid Development Schema-less / Document Oriented FLEXIBILITY by exfordy Friday, May 18, 2012
  • 26. Rapid Development Schema-less / Document Oriented EASIER MIGRATIONS by exfordy Friday, May 18, 2012
  • 27. Rapid Development NO JOINS! Friday, May 18, 2012
  • 28. Performance SPEED by xavi talleda Friday, May 18, 2012
  • 29. Performance SCALABILITY by Jimee, Jackie, Tom & Asha Friday, May 18, 2012
  • 30. A Word of Caution No Transactions No Rollbacks Unsafe defaults Map Reduce locks by Ernst Vikne Friday, May 18, 2012
  • 31. Great Use Cases - Content Management - Product Catalogs - Realtime Analytics - Logs Storage Friday, May 18, 2012
  • 33. PECL driver Linux pecl install mongo echo “extension=mongo.so >> /path/php.ini” OS X http://php-osx.liip.ch/ Windows https://github.com/mongodb/mongo-php-driver/downloads Friday, May 18, 2012
  • 34. Usage <?php // connect $m = new Mongo(); // select a database $db = $m->comedy; // select a collection (analogous to a relational database's table) $collection = $db->cartoons; // add a record $obj = array ( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" ); $collection->insert($obj); // add another record, with a different "shape" $obj = array( "title" => "XKCD", "online" => true ); $collection->insert($obj); // find everything in the collection $cursor = $collection->find(); // iterate through the results foreach ($cursor as $obj) {     echo $obj["title"] . "n"; } ?> Friday, May 18, 2012
  • 35. Storing Files <?php // save a file $id = $grid->storeFile("game.tgz"); $game = $grid->findOne(); // add a downloads counter $game->file['downloads'] = 0; $grid->save($game->file); // increment the counter $grid->update(array("_id" => $id), array('$inc' => array ("downloads" => 1))); ?> Friday, May 18, 2012
  • 36. SQL to Mongo Queries SQL to Mongo Mapping Chart This is a PHP-specific version of the » SQL to Mongo mapping chart in the main docs. SQL Statement Mongo Query Language Statement CREATE TABLE USERS (a Number, b Number) Implicit or use MongoDB::createCollection(). INSERT INTO USERS VALUES(1,1) $db->users->insert(array("a" => 1, "b" => 1)); SELECT a,b FROM users $db->users->find(array(), array("a" => 1, "b" => 1)); SELECT * FROM users WHERE age=33 $db->users->find(array("age" => 33)); SELECT a,b FROM users WHERE age=33 $db->users->find(array("age" => 33), array("a" => 1, "b" => 1)); SELECT a,b FROM users WHERE age=33 ORDER BY name $db->users->find(array("age" => 33), array("a" => 1, "b" => 1))->sort(array("name" => 1)); SELECT * FROM users WHERE age>33 $db->users->find(array("age" => array('$gt' => 33))); SELECT * FROM users WHERE age<33 $db->users->find(array("age" => array('$lt' => 33))); SELECT * FROM users WHERE name LIKE "%Joe%" $db->users->find(array("name" => new MongoRegex("/Joe/"))); SELECT * FROM users WHERE name LIKE "Joe%" $db->users->find(array("name" => new MongoRegex("/^Joe/"))); SELECT * FROM users WHERE age>33 AND age<=40 $db->users->find(array("age" => array('$gt' => 33, '$lte' => 40))); SELECT * FROM users ORDER BY name DESC http://php.net/manual/en/mongo.sqltomongo.php Friday, May 18, 2012
  • 37. Admin Interfaces - Genghis http://genghisapp.com/ - RockMongo http://code.google.com/p/rock-php/wiki/rock_mongo - php-mongodb-admin https://github.com/jwage/php-mongodb-admin Friday, May 18, 2012
  • 38. PHP Libraries - Doctrine ODM - Mandango - many more... Friday, May 18, 2012
  • 39. Doctrine MongoDB ODM http://doctrine-project.org Doctrine MongoDB Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence for PHP objects. Friday, May 18, 2012
  • 40. Doctrine MongoDB ODM /** @Document */ class User { /** @Id */ private $id; /** @String */ private $name; /** @String */ private $email; /** @ReferenceMany(targetDocument="BlogPost", cascade="all") */ private $posts = array(); // ... } Friday, May 18, 2012
  • 41. Doctrine MongoDB ODM /** @Document */ class BlogPost { /** @Id */ private $id; /** @String */ private $title; /** @String */ private $body; /** @Date */ private $createdAt; // ... } Friday, May 18, 2012
  • 42. Doctrine MongoDB ODM <?php // create user $user = new User(); $user->setName('Bulat S.'); $user->setEmail('[email protected]'); // tell Doctrine 2 to save $user on the next flush() $dm->persist($user); // create blog post $post = new BlogPost(); $post->setTitle('My First Blog Post'); $post->setBody('MongoDB + Doctrine 2 ODM = awesomeness!'); $post->setCreatedAt(new DateTime()); $user->addPost($post); // store everything to MongoDB $dm->flush(); Friday, May 18, 2012
  • 43. Doctrine MongoDB ODM Array ( [_id] => 4bec5869fdc212081d000000 [title] => My First Blog Post [body] => MongoDB + Doctrine 2 ODM = awesomeness! [createdAt] => MongoDate Object ( [sec] => 1273723200 [usec] => 0 ) ) Friday, May 18, 2012
  • 44. Doctrine MongoDB ODM Array ( [_id] => 4bec5869fdc212081d010000 [name] => Bulat S. [email] => [email protected] [posts] => Array ( [0] => Array ( [$ref] => blog_posts [$id] => 4bec5869fdc212081d000000 [$db] => test_database ) ) ) Friday, May 18, 2012
  • 45. Doctrine MongoDB ODM $user = $dm->find('User', $userId); $user = $dm->getRepository('User')->findOneByName('Bulat S.'); $posts = $user->getPosts(); foreach ($posts as $post) { echo $post; } Friday, May 18, 2012
  • 46. Doctrine MongoDB ODM Document Repositories // src/YourNamespace/YourBundle/ServerRepository.php namespace YourNamespaceYourBundle; use DoctrineODMMongoDBDocumentRepository; class ServerRepository extends DocumentRepository { public function getActiveServers() { return $this->createQueryBuilder() ->field('isActive')->equals(true) ->sort('name', 'asc')->getQuery()->execute(); } Usage $rep = $dm->getRepository(‘@YourBundle/Server’); $servers = $rep->getActiveServers(); Friday, May 18, 2012
  • 47. Doctrine MongoDB ODM /** @Document */ class Image { /** @Id */ private $id; /** @Field */ private $name; /** @File */ private $file; Friday, May 18, 2012
  • 48. Doctrine MongoDB ODM // store file $image = new Image(); $image->setName('Test image'); $image->setFile('/path/to/image.png'); $dm->persist($image); $dm->flush(); // retrieve and return file to client $image = $dm->createQueryBuilder('DocumentsImage') ->field('name')->equals('Test image') ->getQuery() ->getSingleResult(); header('Content-type: image/png;'); echo $image->getFile()->getBytes(); Friday, May 18, 2012
  • 49. Symfony is a PHP Web Development Framework. Friday, May 18, 2012
  • 50. Symfony2 Bundles - DoctrineMongoDBBundle - MandangoBundle Friday, May 18, 2012
  • 51. DoctrineMongoDBBundle Installation with Composer composer.json { require: { "doctrine/mongodb-odm-bundle": "dev-master" } } $ php composer.phar update Friday, May 18, 2012
  • 52. DoctrineMongoDBBundle Configuring Symfony2 app/autoload.php use DoctrineCommonAnnotationsAnnotationRegistry; AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine- mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/ DoctrineAnnotations.php'); Friday, May 18, 2012
  • 53. DoctrineMongoDBBundle Configuring Symfony2 app/config/config.yml doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: connect: true default_database: test_database document_managers: default: auto_mapping: true Friday, May 18, 2012
  • 54. DoctrineMongoDBBundle app/config/config.yml doctrine_mongodb: connections: default: server: mongodb://localhost:27017 options: connect: true usage: server: mongodb://user:[email protected]:27017 options: replicaSet: true connect: true default_database: test_database document_managers: default: mappings: SGCBundle: ~ SGCRepositoryAppBundle: yml MyBundle: { type: xml, dir: Resources/config/doctrine/ mapping } Friday, May 18, 2012
  • 56. DoctrineMongoDBBundle Defining Documents // src/Acme/StoreBundle/Document/Product.php namespace AcmeStoreBundleDocument; use DoctrineODMMongoDBMappingAnnotations as MongoDB; /** * @MongoDBDocument(collection="product") */ class Product { /** * @MongoDBId */ protected $id; /** * @MongoDBString @MongoDBIndex(unique=true, order="asc") */ protected $name; Friday, May 18, 2012
  • 57. DoctrineMongoDBBundle Using Documents // src/Acme/StoreBundle/Controller/DefaultController.php use AcmeStoreBundleDocumentProduct; use SymfonyComponentHttpFoundationResponse; // ... public function createAction() { $product = new Product(); $product->setName('A Foo Bar'); $product->setPrice('19.99'); $dm = $this->get('doctrine.odm.mongodb.document_manager'); $dm->persist($product); $dm->flush(); return new Response('Created product id '.$product->getId()); } Friday, May 18, 2012
  • 58. Forms Since Documents are Plain PHP Objects integrating it with Symfony Forms is straightforward. public function createAction() { $dm = $this->get ('doctrine.odm.mongodb.default_document_manager'); $form = $this->createForm(new RegistrationType(), new Registration()); $form->bindRequest($this->getRequest()); if ($form->isValid()) { $registration = $form->getData(); $dm->persist($registration->getUser()); $dm->flush(); return $this->redirect(...); } http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/form.html Friday, May 18, 2012
  • 59. Commands Symfony2 Commands doctrine doctrine:mongodb:cache:clear-metadata Clear all metadata cache for a document manager. doctrine:mongodb:fixtures:load Load data fixtures to your database. doctrine:mongodb:generate:documents Generate document classes and method stubs from your mapping information. doctrine:mongodb:generate:hydrators Generates hydrator classes for document classes. doctrine:mongodb:generate:proxies Generates proxy classes for document classes. doctrine:mongodb:generate:repositories Generate repository classes from your mapping information. doctrine:mongodb:mapping:info Show basic information about all mapped documents. doctrine:mongodb:query Query mongodb and inspect the outputted results from your document classes. doctrine:mongodb:schema:create Allows you to create databases, collections and indexes for your documents doctrine:mongodb:schema:drop Allows you to drop databases, collections and indexes for your documents Friday, May 18, 2012
  • 60. Bundles using MongoDB - SonataDoctrineMongoDBAdminBundle - IsmaAmbrosiGeneratorBundle - EbutikMongoSessionBundle - TranslationEditorBundle - ServerGroveLiveChat Friday, May 18, 2012
  • 62. Thank you! Rate Me Please! https://joind.in/6383 Slides: http://slideshare.net/pgodel Twitter: @pgodel E-mail: [email protected] Friday, May 18, 2012