Download the PHP package devmachine/mongoimport without Composer
On this page you can find all versions of the php package devmachine/mongoimport. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devmachine/mongoimport
More information about devmachine/mongoimport
Files in devmachine/mongoimport
Package mongoimport
Short Description Import MongoDB export into Doctrine.
License MIT
Homepage http://devmachine.net
Informations about the package mongoimport
mongoimport
PHP implementation of mongoimport.
About
Why would you need a custom mongoimport instead of default utility supplied with mongo? In certain setup (read Docker) mongo client is not available. With mongo extension enabled in PHP, you can import JSON created by mongoexport with this tiny library.
Provides integration with Symfony (read below), therefore could be used as fixtures loader.
Installation
Add the following to your composer.json:
Usage
Import movies.json into hollywood database. Collection name is figured out automatically by using file's basename without extension.
By default utility connects to mongod running on localhost:27017
. In docker environment default host is MONGO_PORT_27017_TCP_ADDR
and default port is MONGO_PORT_27017_TCP_PORT
.
Overwriting default host, port and collection name:
To drop existing collection prior to import, use --drop
flag.
More info:
Symfony integration
Register bundle in the kernel:
When DoctrineMongoDBBundle is enabled it registers the importer in container for each ODM manager e.g.
devmachine_mongoimport.default
(for default manager)devmachine_mongoimport.secondary
(for secondary manager)devmachine_mongoimport
alias for default importer.
Example:
Contributing
Find below various docker commands.
Init
Load fixtures
Exporting data
From container:
From host: