2017 © Pedro Peláez
 

symfony-bundle simple-mongo-bundle

Bundle for peresisting and retriving information from MongoDB in PHP7

image

exs/simple-mongo-bundle

Bundle for peresisting and retriving information from MongoDB in PHP7

  • Friday, August 19, 2016
  • by rumpranger
  • Repository
  • 7 Watchers
  • 0 Stars
  • 460 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

EXS-SimpleMongoBundle

A simple bundle to persist and execute queries on MongDB database for php7, (*1)

Installing the # EXS-SimpleMongoBundle in a new Symfony2 project

Edit composer.json file with # EXS-SimpleMongoBundle dependency: ``` js //composer.json //... "require": { //other bundles "exs/simple-mongo-bundle": "^1.0" },, (*2)

Save the file and have composer update the project via the command line:
``` shell
composer update exs/simple-mongo-bundle

Update the app/AppKernel.php ``` php //app/AppKernel.php //... public function registerBundles() { $bundles = array( //Other bundles new EXS\SimpleMongoBundle\EXSSimpleMongoBundle(), );, (*3)


## Usage Add your mongodb connection and dbname in the parameter file ``` php simple_mongo: connection: mongodb://localhost:27017 dbname: YOUR_DB_NAME

Create the new collection(Optional) ``` shell app/console exs:create:collection COLLECTION_NAME(Requires) OPTIONS // Options app/console exs:create:collection -h, (*4)


In your controller or service ``` php // Insert data to mongodb $entity = new YourEntity(); $entity->setPropertyValue(THE_VALUE); . . $manager = $this->get('exs_simple_mongo.service'); // get the service $manager->persist($entity); $result = $manager->flush(COLLECTION_NAME); // the result will store the number of inserted entries or error message if(!is_int($result) || $result == 0) { throwException($result); } // Update $filter = ['product' => 6]; $manager->update($filter, $entity); $result = $manager->flush(COLLECTION_NAME); // Get data with query $filter = ['product' => 6]; $option = ['projection' => ['_id' => 0]]; $manager = $this->get('exs_simple_mongo.service'); // get the service $result = $manager->exeQuery($filter, $option, COLLECTION_NAME); // $result will contain results in an array

Contributing

Anyone and everyone is welcome to contribute., (*5)

If you have any questions or suggestions please [let us know][1]., (*6)

The Versions

19/08 2016

dev-master

9999999-dev https://github.com/ExSituMarketing/EXS-SimpleMongoBundle

Bundle for peresisting and retriving information from MongoDB in PHP7

  Sources   Download

MIT

The Requires

 

by Jangyong Lee

mongodb php bundle mongo

18/08 2016

v1.0.1

1.0.1.0 https://github.com/ExSituMarketing/EXS-SimpleMongoBundle

Bundle for peresisting and retriving information from MongoDB in PHP7

  Sources   Download

MIT

The Requires

 

by Jangyong Lee

mongodb php bundle mongo

05/08 2016

v1.0

1.0.0.0 https://github.com/ExSituMarketing/EXS-SimpleMongoBundle

Bundle for peresisting and retriving information from MongoDB in PHP7

  Sources   Download

MIT

The Requires

 

by Jangyong Lee

mongodb php bundle mongo