Inside your document repository, you can add a private method like this:
private function _getNativeConnection(){
$connection = $this->getDocumentManager()->getConnection();
$mongo = $connection->getMongo();
if(!$mongo){
$connection->connect();
$mongo = $connection->getMongo();
}
//You can use this as literal strings, or pass them as parameters to the method
$db = $mongo->selectDB('YOUR_MONGO_DB')->selectCollection("MONGO_COLLECTION");
return $db;
}
Then, you can use it from another repository method like this:
public function another_public_method{
...
$collection = $this->_getNativeConnection();
...
}
The $collection, represents a PHP MongoCollection (http://php.net/manual/en/class.mongocollection.php), with that you can use native Mongo queries (through the class interface).
You can't exactly write the literal query, but, through the interface you can do whatever you want, query, aggregate, etc...
This is what you need to do?
Regards