Class DateToParts
- java.lang.Object
-
- dev.morphia.aggregation.experimental.expressions.impls.Expression
-
- dev.morphia.aggregation.experimental.expressions.impls.DateToParts
-
public class DateToParts extends Expression
Returns a document that contains the constituent parts of a given BSON Date value as individual properties. The properties returned are year, month, day, hour, minute, second and millisecond.Developer note.This is an internal item. Its function and presence are subject to change without warning. Its use is highly discouraged.
-
-
Constructor Summary
Constructors Constructor Description DateToParts(Expression date)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
encode(Mapper mapper, org.bson.BsonWriter writer, org.bson.codecs.EncoderContext encoderContext)
DateToParts
iso8601(boolean iso8601)
Optional.DateToParts
timezone(Expression timezone)
The optional timezone to use to format the date.-
Methods inherited from class dev.morphia.aggregation.experimental.expressions.impls.Expression
getOperation, getValue, toString
-
-
-
-
Constructor Detail
-
DateToParts
public DateToParts(Expression date)
-
-
Method Detail
-
encode
public void encode(Mapper mapper, org.bson.BsonWriter writer, org.bson.codecs.EncoderContext encoderContext)
- Overrides:
encode
in classExpression
- Parameters:
mapper
- the mapperwriter
- the writerencoderContext
- the context
-
iso8601
public DateToParts iso8601(boolean iso8601)
Optional. If set to true, modifies the output document to use ISO week date fields. Defaults to false.- Parameters:
iso8601
- true to use ISO 8601- Returns:
- this
-
timezone
public DateToParts timezone(Expression timezone)
The optional timezone to use to format the date. By default, it uses UTC.- Parameters:
timezone
- the expression- Returns:
- this
-
-