1. Go to this page and download the library: Download devmachine/mongoimport 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/ */
devmachine / mongoimport example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle(),
new Devmachine\MongoImport\Bundle\DevmachineMongoImportBundle(),
);
}
// Import movies.json into "movies" collection in default database.
$total = $this
->get('devmachine_mongoimport')
->importCollection('movies.json')
;
// Drop existing collection prior to import.
$total = $this
->get('devmachine_mongoimport')
->import('movies.json', ['drop' => true])
;
// With specified collection name.
$total = $this
->get('devmachine_mongoimport')
->import('movies.json', 'films', ['drop' => true])
;
// With specified collection and db.
$total = $this
->get('devmachine_mongoimport')
->import('movies.json', 'films', 'hollywood', ['drop' => true])
;
bash
$ docker-compose run --entrypoint php composer fixtures/load.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.