Answers for "doctrine mongodb native query"

PHP
1

doctrine mongodb native query

/** @var DocumentManager $documentManager */
$documentManager = $this->container
	->get('doctrine_mongodb')
	->getManager();

$mongoClient = $documentManager->getConnection()->getMongoClient();

$db = $mongoClient->selectDB('dbname');

$collection = $mongoClient->selectCollection($db, 'collectionName');
$results = $collection->find();
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language