Class MongoDBSubStringFunction
java.lang.Object
com.kingsrook.qqq.backend.module.mongodb.fieldfunctions.MongoDBSubStringFunction
- All Implemented Interfaces:
BackendFieldFunctionAdapterInterface,MongoDBFieldFunctionAdapterInterface,Serializable
public class MongoDBSubStringFunction
extends Object
implements MongoDBFieldFunctionAdapterInterface
MongoDB adapter for SubStringFunction.
Generates {$substrCP: ["$field", fromIndex, length]}.
MongoDB $substrCP is 0-based; QQQ SubStringFunction uses 1-based (like SQL).
When no length is specified, uses Integer.MAX_VALUE as a sentinel.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetExpression(String fieldReference, FieldFunction fieldFunction, Function<String, String> fieldNameToFieldReference) Returns a MongoDB aggregation expression for the given field reference.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.kingsrook.qqq.backend.module.mongodb.fieldfunctions.MongoDBFieldFunctionAdapterInterface
getExpressionForOrderBy
-
Constructor Details
-
MongoDBSubStringFunction
public MongoDBSubStringFunction()
-
-
Method Details
-
getExpression
public Object getExpression(String fieldReference, FieldFunction fieldFunction, Function<String, String> fieldNameToFieldReference) Description copied from interface:MongoDBFieldFunctionAdapterInterfaceReturns a MongoDB aggregation expression for the given field reference. The fieldReference is a "$"-prefixed field name (e.g., "$firstName").- Specified by:
getExpressionin interfaceMongoDBFieldFunctionAdapterInterface- 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).
-