lithium\data\source\MongoDb::sources()
Implements
lithium\data\Source::sources()
Returns the list of collections in the currently-connected database.
Parameters
-
string
$class
The fully-name-spaced class name of the model object making the request.
Returns
arrayReturns an array of objects to which models can connect.
Source
public function sources($class = null) {
$collections = $this->manager->executeCommand($this->_config['database'], new Command(['listCollections' => 1]));
$names = [];
foreach ($collections as $collection) {
$names[] = $collection->name;
}
return $names;
}