PHP code example of pouzor / mongodbbundle

1. Go to this page and download the library: Download pouzor/mongodbbundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pouzor / mongodbbundle example snippets


//document.manager.my_project is specific mongodb (db, host, port...) configuration in app/config/config.yml
$manager = $this->getContainer()->get('document.manager.my_project');


$repository = $manager->getRepository('User');


$user = $repository->find($id);
$users = $repository->findBy(['location' => "Paris"]);


$repository->deleteMany(['gift' => ['$lte' => 0]]);