You are here

public static function MongoCollectionFactory::create in MongoDB 8

Factory method for this class.

Parameters

Settings $settings:

Return value

static

File

src/MongoCollectionFactory.php, line 74
Definition of Drupal\mongodb\MongodbBundle.

Class

MongoCollectionFactory
Creates mongo collections based on settings.

Namespace

Drupal\mongodb

Code

public static function create(Settings $settings) {
  if ($mongo = $settings
    ->get('mongo', [])) {
    return new static($mongo);
  }
  return static::createFromDatabase();
}