- Issue created by @daffie
- Assigned to nishtha.pradhan
- Issue was unassigned.
MongoDB does not support SQL strings. Therefor it cannot support the method addExpression($expression)
. MongoDB can support operation specific expressions.
What MongoDB cannot support:
$query = \Drupal::database()->select('some_table');
$count = $query->addExpression('COUNT(some_field)');
$count_all = $query->addExpression('COUNT(*)');
$count_distinct = $query->addExpression('COUNT(DISTINCT(some_field))');
$sum = $query->addExpression('SUM(some_field)');
$min = $query->addExpressionConstant('MIN(some_field)');
$max = $query->addExpressionField('MAX(some_field)');
$coalesce = $query->addExpression('COALESCE(some_field1, some_field2, ...)');
$field = $query->addExpressionMax('some_field');
$constant = $query->addExpressionMin('some_value');
What MongoDB can support:
$query = \Drupal::database()->select('some_table');
$count = $query->addExpressionCount('some_field');
$count_all = $query->addExpressionCountAll();
$count_distinct = $query->addExpressionCountDistinct('some_field');
$sum = $query->addExpressionSum('some_field');
$min = $query->addExpressionMin('some_field');
$max = $query->addExpressionMax('some_field');
$coalesce = $query->addExpressionCoalesce( array of some fields);
$field = $query->addExpressionField('some_field');
$contant = $query->addExpressionContant('some_value');
Add the new methods to the Database API and use them as much as possible in core.
Do it.
None
The following methods are added:
None
TBD