Class MongoDBStringLengthFunction

java.lang.Object
com.kingsrook.qqq.backend.module.mongodb.fieldfunctions.MongoDBStringLengthFunction
All Implemented Interfaces:
BackendFieldFunctionAdapterInterface, MongoDBFieldFunctionAdapterInterface, Serializable

public class MongoDBStringLengthFunction extends Object implements MongoDBFieldFunctionAdapterInterface
MongoDB adapter for StringLengthFunction. Generates {$strLenCP: "$field"} — Unicode code point count, equivalent to SQL CHAR_LENGTH.
See Also:
  • Constructor Details

    • MongoDBStringLengthFunction

      public MongoDBStringLengthFunction()
  • Method Details

    • getExpression

      public Object getExpression(String fieldReference, FieldFunction fieldFunction, Function<String,String> fieldNameToFieldReference)
      Description copied from interface: MongoDBFieldFunctionAdapterInterface
      Returns a MongoDB aggregation expression for the given field reference. The fieldReference is a "$"-prefixed field name (e.g., "$firstName").
      Specified by:
      getExpression in interface MongoDBFieldFunctionAdapterInterface
      Parameters:
      fieldReference - "$"-prefixed field name for the function's source field.
      fieldFunction - the function with arguments.
      fieldNameToFieldReference - resolves a QQQ field name to its "$"-prefixed MongoDB field reference (e.g., "timeZone" → "$time_zone"). Useful when the function expression needs to reference additional fields on the same document (e.g., a per-row timezone field).