You are here

protected function FindCommand::configure in MongoDB 8.2

File

modules/mongodb/src/Command/FindCommand.php, line 59

Class

FindCommand
Class FindCommand provides the 'commands.mongodb.find' command.

Namespace

Drupal\mongodb\Command

Code

protected function configure() {
  $name = static::NAME;
  $arguments = "{$name}.arguments";
  $usageGeneric = <<<USAGE
<collection> <query>
    <query> is a single JSON selector in single string format. Quote it.
USAGE;
  $usageNoSelector = <<<USAGE
logger watchdog
    Get the logger/watchdog error-level templates
USAGE;
  $usageStringInt = <<<USAGE
logger watchdog '{ "severity": 3 }'
    Get all the logger/watchdog entries tracking rows.
USAGE;
  $usageTwoStrings = <<<USAGE
keyvalue kvp_state '{ "_id": "system.theme_engine.files" }'
    Get a specific State entry. Note how escaping needs to be performed in the shell.
USAGE;
  $this
    ->setName('mongodb:find')
    ->setAliases([
    'mdbf',
    'mo-find',
  ])
    ->setDescription($this
    ->trans("{$name}.description"))
    ->setHelp($this
    ->trans("{$name}.help"))
    ->addUsage($usageGeneric)
    ->addUsage($usageNoSelector)
    ->addUsage($usageStringInt)
    ->addUsage($usageTwoStrings)
    ->addArgument('alias', InputArgument::REQUIRED, "{$arguments}.alias")
    ->addArgument('collection', InputArgument::REQUIRED, "{$arguments}.collection")
    ->addArgument('selector', InputArgument::OPTIONAL, "{$arguments}.selector", '{ }');
}