Created
October 5, 2016 20:31
-
-
Save renanpalmeira/a18e3467d7c16c363cbf9bc237b36128 to your computer and use it in GitHub Desktop.
Wrapper MongoDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UmaCollection extends MongoDB | |
{ | |
public function find() | |
{ | |
var_dump($this->collection); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$setup = new MongoDB(); | |
$setup->connect('mongodn://...', 'geroudo', 'coisas'); | |
include 'collection.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MongoDB | |
{ | |
protected $connect = null; | |
public function connect($server, $db, $collection) | |
{ | |
$connection = new \MongoClient($server); | |
$db = $connection->selectDB($db); | |
$this->collection = new \MongoCollection($db, $collection); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment